-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FR: replace --> with → #143
Comments
Thanks for opening your first issue here! Engagement like this is essential for open source projects! 🤗 |
Thanks @PhilipMay, it definitely seems feasible as we are already looking for This being a port though, this issue perhaps makes it a bit problematic to implement directly in "core" 😬: markdown-it/markdown-it#543 |
@chrisjsewell so you mean that I should add it as a plugin at https://github.com/executablebooks/mdit-py-plugins right? Could you please give me some more hints on how to do that? |
yep 👍
There not actually any documentation specifically for creating plugins (yet), but obviously if you haven't already read https://markdown-it-py.readthedocs.io/en/latest/using.html and https://markdown-it-py.readthedocs.io/en/latest/architecture.html The plugin would look something like this, such that you literally are replacing the current "replace" rule (in https://github.com/executablebooks/markdown-it-py/blob/master/markdown_it/rules_core/replacements.py) with a different one: def replace_plus_plugin(md: MarkdownIt):
# Replace existing replace rule by name with new function.
md.core.ruler.at("replace", replace_plus)
def replace_plus(state: StateCore, *args, **kwargs) -> None:
for token in state.tokens:
if token.type != "inline":
continue
assert token.children is not None
if SCOPED_ABBR_RE.search(token.content):
replace_scoped(token.children)
if RARE_RE.search(token.content):
replace_rare(token.children) Although I just realised this won't actually work yet in v0.6.2 , because of #146 😬 |
Great @chrisjsewell |
Well - #146 seems to be merged new. |
Hi,
what do you think about maybe adding the following replacement to your replacements extension:
Replace --> with →
That would be very useful to write documentations where I often want to say something like:
Go to this menu: Files -> Sessings -> Colors
I would try and provide an PR if you agree.
Thanks
Philip
The text was updated successfully, but these errors were encountered: