diff options
Diffstat (limited to 'public/js')
-rw-r--r-- | public/js/extra.js | 10 | ||||
-rw-r--r-- | public/js/syncscroll.js | 11 |
2 files changed, 21 insertions, 0 deletions
diff --git a/public/js/extra.js b/public/js/extra.js index a72ca5e1..7b4eb0c0 100644 --- a/public/js/extra.js +++ b/public/js/extra.js @@ -728,6 +728,16 @@ md.use(window.markdownitIns); md.use(window.markdownitSub); md.use(window.markdownitSup); md.use(window.markdownitMathjax); +function renderContainer(tokens, idx, options, env, self) { + tokens[idx].attrJoin('role', 'alert'); + tokens[idx].attrJoin('class', 'alert'); + tokens[idx].attrJoin('class', 'alert-' + tokens[idx].info.trim()); + return self.renderToken.apply(self, arguments); +} +md.use(window.markdownitContainer, 'success', { render: renderContainer }); +md.use(window.markdownitContainer, 'info', { render: renderContainer }); +md.use(window.markdownitContainer, 'warning', { render: renderContainer }); +md.use(window.markdownitContainer, 'danger', { render: renderContainer }); md.renderer.rules.image = function (tokens, idx, options, env, self) { tokens[idx].attrJoin('class', 'raw'); diff --git a/public/js/syncscroll.js b/public/js/syncscroll.js index 7cf62bc5..890188cb 100644 --- a/public/js/syncscroll.js +++ b/public/js/syncscroll.js @@ -93,6 +93,17 @@ md.renderer.rules.code_block = function (tokens, idx, options, env, self) { } return '<pre><code>' + md.utils.escapeHtml(tokens[idx].content) + '</code></pre>\n'; }; +function renderContainer(tokens, idx, options, env, self) { + tokens[idx].attrJoin('role', 'alert'); + tokens[idx].attrJoin('class', 'alert'); + tokens[idx].attrJoin('class', 'alert-' + tokens[idx].info.trim()); + addPart(tokens, idx); + return self.renderToken.apply(self, arguments); +} +md.use(window.markdownitContainer, 'success', { render: renderContainer }); +md.use(window.markdownitContainer, 'info', { render: renderContainer }); +md.use(window.markdownitContainer, 'warning', { render: renderContainer }); +md.use(window.markdownitContainer, 'danger', { render: renderContainer }); var preventSyncScroll = false; |