mirror of
https://github.com/discourse/discourse.git
synced 2024-12-01 21:19:41 -06:00
f3467ee673
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. |
||
---|---|---|
.. | ||
assets | ||
controllers | ||
helpers | ||
jobs | ||
mailers | ||
models | ||
serializers | ||
services | ||
views |