-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Add markdown extension mechanism and syntax #821
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
Conversation
using this on my fork and it works great! |
Just tried this out and its great but there are a few issues. Firstly it throws The second issue we've run into is that if you have a number of the same tags after each other it "eats" them. That is to say without block content under each of them they disappear. An example is:
Will only show the first link and if there were additional items under the second one, in our case 8 in total it would still only show the first one. Apart from these issues the system works really well and if I get a chance I'll look into a resolution. Edit: Changing line 204 to the same as below seems to fix both issues: block: ( cap[4] !== undefined ? cap[4].replace(new RegExp('^' + cap[4].match(/^\s+/)[0], 'gm'), '') : undefined ), |
* Fix rule processing in code @jHoldroyd * Add example * Rewrite tests from ECMA2017 to ECMA 5
@jHoldroyd Thanks. Fixed this. |
Nice. Maybe add a plugin examples folder for demo? |
@naivefun Do you expect to see exact plugin example? |
@naivefun Done. |
Just following up on the previous problem we reported, happy to say the initial error has been resolved since you pulled in my suggestion, the "eating" of tags is still occasionally happening though. I managed to get around it by updating the plugin regex on line 98-100 to: block.extra = {
plugin: /^@!?([A-Za-z0-9_-]+) *\( *((.+) *)?\).*?\n((\s+){2,}.*\n(((\5).*\n)|\n)*)?/
}; This allows the script to catch all indented text below a plugin tag but nothing that isn't nested. An example of this fix can be seen here: https://regex101.com/r/76YMYB/1 which you can compare to the original regex pattern here: https://regex101.com/r/QjLRlL/1 Hope this helps. |
@jHoldroyd There is one issue with that regexp it will not match single space.
This will not be matched, it mean that single tab would not be matched too. So I've replaced Thanks for help. |
I realise no-plugin block which should return html/text if plugin is not defined:
It currently doesn't support markdown itself. |
Closing due to merge conflicts. See #1026 as well. |
I've added markdown extension mechanism. It uses plugins with such syntax:
Examples:
Plugins are defined with Renderer:
By default if plugin not found it should be ignored.