discourse/app/assets/javascripts/pretty-text/addon
Martin Brennan f3467ee673
FEATURE: Add requestCustomMarkdownCookFunction API (#15753)
This commit adds a requestCustomMarkdownCookFunction function
to the `helper` that is provided to custom markdown rules
via their `setup` function.

The way this works is that once the default markdown engine that
we use for cooking posts has been set up, we loop through all
of the callbacks registered by `requestCustomMarkdownCookFunction`
and call `_buildCustomMarkdownCookFunction`. This creates
a new markdown engine using many of the same settings as the
default one, but will allow for the following options to be
changed by the markdown rule requesting the custom function:

* featuresOverride - The markdown-it features to allow for the engine
* markdownItRules - The markdown-it rules to allow for the engine

After this engine is set up a render function which renders + sanitizes
the output is returned for use by the markdown rule.

The use case for this API is mainly for block BBCode markdown rules
which want to render their content with a limited subset of the
markdown features/rules. Our initial use case for this is chat message
quoting.

This commit also does some minor refactoring of discourse-markdown-it
to accommodate this new engine building.
2022-02-04 09:00:40 +10:00
..
emoji FEATURE: Add missing emojis (#15582) 2022-01-14 17:51:13 -03:00
engines FEATURE: Add requestCustomMarkdownCookFunction API (#15753) 2022-02-04 09:00:40 +10:00
allow-lister.js FIX: Do not perform link lookup for replaced links (#14742) 2021-10-28 13:27:31 +03:00
censored-words.js DEV: apply new coding standards (#10592) 2020-09-04 13:42:47 +02:00
emoji.js FEATURE: Partial match aliases in emoji filter (#15613) 2022-02-01 22:36:48 +01:00
guid.js DEV: apply new coding standards (#10592) 2020-09-04 13:42:47 +02:00
inline-oneboxer.js DEV: removes jquery usage from onebox (#14683) 2021-10-22 13:15:46 +02:00
oneboxer-cache.js DEV: removes jquery usage from onebox (#14683) 2021-10-22 13:15:46 +02:00
oneboxer.js DEV: Allow utility class domFromString to take in strings with multiple top level elements (#15548) 2022-01-12 19:49:24 +08:00
pretty-text.js DEV: Add markdown_additional_options to Site (#15738) 2022-01-28 13:02:02 +10:00
sanitizer.js SECURITY: Sanitize d-popover attributes (#13958) 2021-08-05 16:39:17 +03:00
upload-short-url.js FEATURE: Use diffhtml to update composer preview (#11237) 2021-02-18 16:07:26 +02:00
white-lister.js DEV: Sort imports alphabetically (#11382) 2020-12-01 15:31:26 -03:00