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
* add katex plugin
* Delete markdown-it/test.js
* Update authors and description
* overwrite mdHtml rather than returning out
* Revert "overwrite mdHtml rather than returning out"
This reverts commit cac4c27.
* fix the path problem
* fix formatting
* fix more formatting
"description": "This script replaces the default markdown renderer with markdown-it.\n\n<b>Dependencies</b>\n<a href=\"https://github.com/markdown-it/markdown-it\">markdown-it.js</a> (v8.4.2 bundled with the script)\n\n<b>Usage</b>\nFor the possible configuration options check <a href=\"https://github.com/markdown-it/markdown-it/tree/master/lib/presets\">here</a>.\n\n<b>Important</b>\nThis script currently only works with <a href=\"https://github.com/qownnotes/scripts/issues/77\"><b>legacy media links</b></a>. You can turn them on in the <i>General Settings</i>.\n\nImportant note: You need to use legacy image linking with this script, otherwise there will be no images shown in the preview!"
9
+
"description": "This script replaces the default markdown renderer with markdown-it and allows for optional LaTeX rendering support with the Markdown-It KaTeX plugin. (NOTE: LaTeX defaults to rendering with MathML ONLY). \n\n<b>Dependencies</b>\n<a href=\"https://github.com/markdown-it/markdown-it\">markdown-it.js</a> (v8.4.2 bundled with the script)\n<a href=\"https://github.com/mdit-plugins/mdit-plugins/tree/main/packages/katex\">Markdown-It KaTeX plugin</a> (v0.18.0 bundled with the script)\n\n<b>Usage</b>\nFor the possible configuration options check <a href=\"https://github.com/markdown-it/markdown-it/tree/master/lib/presets\">here</a>.\n\n<b>Important</b>\nThis script currently only works with <a href=\"https://github.com/qownnotes/scripts/issues/77\"><b>legacy media links</b></a>. You can turn them on in the <i>General Settings</i>.\n\nImportant note: You need to use legacy image linking with this script, otherwise there will be no images shown in the preview!"
"description":"For available options and default values see <a href='https://github.com/markdown-it/markdown-it/blob/master/lib/presets'>markdown-it presets</a>.",
16
-
"type":"text",
17
-
"default": "{" + "\n" + " //html: false, // Enable HTML tags in source" + "\n" + " //xhtmlOut: false, // Use '/' to close single tags (<br />)" + "\n" + " //breaks: false, // Convert '\\n' in paragraphs into <br>" + "\n" + " //langPrefix: 'language-', // CSS language prefix for fenced blocks" + "\n" + " //linkify: false, // autoconvert URL-like texts to links" + "\n" + "" + "\n" + " // Enable some language-neutral replacements + quotes beautification" + "\n" + " //typographer: false," + "\n" + "" + "\n" + " // Double + single quotes replacement pairs, when typographer enabled," + "\n" + " // and smartquotes on. Could be either a String or an Array." + "\n" + " //" + "\n" + " // For example, you can use '«»„“' for Russian, '„“‚‘' for German," + "\n" + " // and ['«\\xA0', '\\xA0»', '‹\\xA0', '\\xA0›'] for French (including nbsp)." + "\n" + " //quotes: '\\u201c\\u201d\\u2018\\u2019', /* “”‘’ */" + "\n" + "" + "\n" + " // Highlighter function. Should return escaped HTML," + "\n" + " // or '' if the source string is not changed and should be escaped externaly." + "\n" + " // If result starts with <pre... internal wrapper is skipped." + "\n" + " //" + "\n" + " // function (/*str, lang*/) { return ''; }" + "\n" + " //" + "\n" + " //highlight: null," + "\n" + "" + "\n" + " //maxNesting: 100 // Internal protection, recursion limit" + "\n" + "}"
18
-
},
19
-
{
20
-
"identifier":"useDeflistPlugin",
21
-
"name":"Definition lists",
22
-
"text":"Enable the Mardown-it definition list (<dl>) plugin",
23
-
"type":"boolean",
24
-
"default":false
25
-
},
26
-
{
27
-
"identifier":"customStylesheet",
28
-
"name":"Custom stylesheet",
29
-
"description":"Please enter your custom stylesheet:",
30
-
"type":"text",
31
-
"default":null
32
-
},
33
-
]
11
+
property variant settingsVariables: [{
12
+
"identifier":"options",
13
+
"name":"Markdown-it options",
14
+
"description":"For available options and default values see <a href='https://github.com/markdown-it/markdown-it/blob/master/lib/presets'>markdown-it presets</a>.",
15
+
"type":"text",
16
+
"default": "{" + "\n" + " //html: false, // Enable HTML tags in source" + "\n" + " //xhtmlOut: false, // Use '/' to close single tags (<br />)" + "\n" + " //breaks: false, // Convert '\\n' in paragraphs into <br>" + "\n" + " //langPrefix: 'language-', // CSS language prefix for fenced blocks" + "\n" + " //linkify: false, // autoconvert URL-like texts to links" + "\n" + "" + "\n" + " // Enable some language-neutral replacements + quotes beautification" + "\n" + " //typographer: false," + "\n" + "" + "\n" + " // Double + single quotes replacement pairs, when typographer enabled," + "\n" + " // and smartquotes on. Could be either a String or an Array." + "\n" + " //" + "\n" + " // For example, you can use '«»„“' for Russian, '„“‚‘' for German," + "\n" + " // and ['«\\xA0', '\\xA0»', '‹\\xA0', '\\xA0›'] for French (including nbsp)." + "\n" + " //quotes: '\\u201c\\u201d\\u2018\\u2019', /* “”‘’ */" + "\n" + "" + "\n" + " // Highlighter function. Should return escaped HTML," + "\n" + " // or '' if the source string is not changed and should be escaped externaly." + "\n" + " // If result starts with <pre... internal wrapper is skipped." + "\n" + " //" + "\n" + " // function (/*str, lang*/) { return ''; }" + "\n" + " //" + "\n" + " //highlight: null," + "\n" + "" + "\n" + " //maxNesting: 100 // Internal protection, recursion limit" + "\n" + "}"
17
+
}, {
18
+
"identifier":"useDeflistPlugin",
19
+
"name":"Definition lists",
20
+
"text":"Enable the Markdown-it definition list (<dl>) plugin",
21
+
"type":"boolean",
22
+
"default":false
23
+
}, {
24
+
"identifier":"useKatexPlugin",
25
+
"name":"LaTeX Support",
26
+
"text":"Enable the Markdown-it definition list KaTeX plugin",
27
+
"type":"boolean",
28
+
"default":false
29
+
}, {
30
+
"identifier":"customStylesheet",
31
+
"name":"Custom stylesheet",
32
+
"description":"Please enter your custom stylesheet:",
33
+
"type":"text",
34
+
"default":null
35
+
}]
34
36
property bool useDeflistPlugin
37
+
property bool useKatexPlugin
35
38
36
39
functioninit() {
37
40
var optionsObj =eval("("+ options +")");
38
-
// md = new MarkdownIt.markdownit(optionsObj);
39
-
md =newthis.markdownit(optionsObj); // workaround because its a node module and qml-browserify didn't work
41
+
md =newthis.markdownit(optionsObj);
42
+
if (useDeflistPlugin)
43
+
md.use(this.markdownitDeflist);
40
44
41
-
if (useDeflistPlugin) {
42
-
// md.use(MarkdownItDeflist.markdownitDeflist);
43
-
md.use(this.markdownitDeflist); // workaround because its a node module and qml-browserify didn't work
0 commit comments