You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using marked to render Markdown in an application, but I have a situation where I want to create some 'custom' renderings - similar to the way gimmicks are used in md-wiki.
I want to add some custom rules, such as the following;
[!alert:warning] > some text goes here as a warning
[!alert:success] > some text goes here as success
And have it render output like...
<blockquote class="alert warning">Some text goes here as a warning</blockquote>
<blockquote class="alert success">Some text goes here as success</blockquote>
I've seen that I can do this in marked by adding to the rules on the block literal, but this requires me to hard-code them into the actual library. Is there a way to add a rule to marked at runtime, that can allow me to leave the core library alone?
The text was updated successfully, but these errors were encountered:
I think instead of overriding an existing method, what OP wants is to define a custom rule.
e.g. All existing rules should stay the same, but maybe { some text } (or something similar) has a custom behavior.
I am using marked to render Markdown in an application, but I have a situation where I want to create some 'custom' renderings - similar to the way
gimmicks
are used in md-wiki.I want to add some custom rules, such as the following;
And have it render output like...
I've seen that I can do this in
marked
by adding to therules
on theblock
literal, but this requires me to hard-code them into the actual library. Is there a way to add a rule to marked at runtime, that can allow me to leave the core library alone?The text was updated successfully, but these errors were encountered: