mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
Desktop, Mobile: Fix TOC with special characters (#2052)
This commit is contained in:
parent
3cac187023
commit
83c3c027d0
@ -28,9 +28,13 @@ const plugins = {
|
|||||||
emoji: { module: require('markdown-it-emoji') },
|
emoji: { module: require('markdown-it-emoji') },
|
||||||
insert: { module: require('markdown-it-ins') },
|
insert: { module: require('markdown-it-ins') },
|
||||||
multitable: { module: require('markdown-it-multimd-table'), options: { enableMultilineRows: true, enableRowspan: true } },
|
multitable: { module: require('markdown-it-multimd-table'), options: { enableMultilineRows: true, enableRowspan: true } },
|
||||||
toc: { module: require('markdown-it-toc-done-right'), options: { listType: 'ul' } },
|
toc: { module: require('markdown-it-toc-done-right'), options: { listType: 'ul', slugify: uslugify } },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function uslugify(s) {
|
||||||
|
return uslug(s);
|
||||||
|
}
|
||||||
|
|
||||||
class MdToHtml {
|
class MdToHtml {
|
||||||
constructor(options = null) {
|
constructor(options = null) {
|
||||||
if (!options) options = {};
|
if (!options) options = {};
|
||||||
@ -145,9 +149,7 @@ class MdToHtml {
|
|||||||
if (Setting.value('markdown.plugin.fountain')) markdownIt.use(rules.fountain(context, ruleOptions));
|
if (Setting.value('markdown.plugin.fountain')) markdownIt.use(rules.fountain(context, ruleOptions));
|
||||||
markdownIt.use(rules.highlight_keywords(context, ruleOptions));
|
markdownIt.use(rules.highlight_keywords(context, ruleOptions));
|
||||||
markdownIt.use(rules.code_inline(context, ruleOptions));
|
markdownIt.use(rules.code_inline(context, ruleOptions));
|
||||||
markdownIt.use(markdownItAnchor, {
|
markdownIt.use(markdownItAnchor, { slugify: uslugify });
|
||||||
slugify: s => uslug(s),
|
|
||||||
});
|
|
||||||
|
|
||||||
for (let key in plugins) {
|
for (let key in plugins) {
|
||||||
if (Setting.value(`markdown.plugin.${key}`)) markdownIt.use(plugins[key].module, plugins[key].options);
|
if (Setting.value(`markdown.plugin.${key}`)) markdownIt.use(plugins[key].module, plugins[key].options);
|
||||||
|
Loading…
Reference in New Issue
Block a user