diff --git a/docs/PREFERENCES.md b/docs/PREFERENCES.md index 48c5f252..441aa423 100644 --- a/docs/PREFERENCES.md +++ b/docs/PREFERENCES.md @@ -50,6 +50,7 @@ Preferences can be controlled and modified in the settings window or via the `pr | listIndentation | String | 1 | The list indentation of sub list items or paragraphs, optional value `dfm`, `tab` or number 1~4 | | frontmatterType | String | `-` | The frontmatter type: `-` (YAML), `+` (TOML), `;` (JSON) or `{` (JSON) | | superSubScript | Boolean | `false` | Enable pandoc's markdown extension superscript and subscript. | +| footnote | Boolean | `false` | Enable pandoc's markdown extension footnote | #### Theme diff --git a/src/main/preferences/schema.json b/src/main/preferences/schema.json index 03755007..110916fa 100644 --- a/src/main/preferences/schema.json +++ b/src/main/preferences/schema.json @@ -237,6 +237,11 @@ "type": "boolean", "default": false }, + "footnote": { + "description": "Markdown-Enable pandoc's markdown extension footnote.", + "type": "boolean", + "default": false + }, "theme": { "description": "Theme--Select the theme used in Mark Text", diff --git a/src/muya/lib/config/index.js b/src/muya/lib/config/index.js index 53d1e54f..a5a368bb 100644 --- a/src/muya/lib/config/index.js +++ b/src/muya/lib/config/index.js @@ -277,7 +277,7 @@ export const MUYA_DEFAULT_OPTION = { // Markdown extensions superSubScript: false, - footnote: true + footnote: false } // export const DIAGRAM_TEMPLATE = { diff --git a/src/muya/lib/parser/marked/options.js b/src/muya/lib/parser/marked/options.js index 8a8e3022..3d3a8158 100644 --- a/src/muya/lib/parser/marked/options.js +++ b/src/muya/lib/parser/marked/options.js @@ -29,5 +29,5 @@ export default { math: true, frontMatter: true, superSubScript: false, - footnote: true + footnote: false } diff --git a/src/muya/lib/utils/exportHtml.js b/src/muya/lib/utils/exportHtml.js index b35cc060..11c6be20 100644 --- a/src/muya/lib/utils/exportHtml.js +++ b/src/muya/lib/utils/exportHtml.js @@ -107,6 +107,7 @@ class ExportHtml { this.mathRendererCalled = false let html = marked(this.markdown, { superSubScript: this.muya ? this.muya.options.superSubScript : false, + footnote: this.muya ? this.muya.options.footnote : false, highlight (code, lang) { // Language may be undefined (GH#591) if (!lang) { diff --git a/src/renderer/components/editorWithTabs/editor.vue b/src/renderer/components/editorWithTabs/editor.vue index 9939d6ec..237e8725 100644 --- a/src/renderer/components/editorWithTabs/editor.vue +++ b/src/renderer/components/editorWithTabs/editor.vue @@ -137,6 +137,7 @@ export default { listIndentation: state => state.preferences.listIndentation, frontmatterType: state => state.preferences.frontmatterType, superSubScript: state => state.preferences.superSubScript, + footnote: state => state.preferences.footnote, lineHeight: state => state.preferences.lineHeight, fontSize: state => state.preferences.fontSize, codeFontSize: state => state.preferences.codeFontSize, @@ -251,6 +252,12 @@ export default { editor.setOptions({ superSubScript: value }, true) } }, + footnote: function (value, oldValue) { + const { editor } = this + if (value !== oldValue && editor) { + editor.setOptions({ footnote: value }, true) + } + }, hideQuickInsertHint: function (value, oldValue) { const { editor } = this if (value !== oldValue && editor) { @@ -447,6 +454,7 @@ export default { listIndentation, frontmatterType, superSubScript, + footnote, hideQuickInsertHint, editorLineWidth, theme, @@ -490,6 +498,7 @@ export default { listIndentation, frontmatterType, superSubScript, + footnote, hideQuickInsertHint, hideLinkPopup, spellcheckEnabled: spellcheckerEnabled, diff --git a/src/renderer/prefComponents/markdown/index.vue b/src/renderer/prefComponents/markdown/index.vue index a6e6d8ed..8a939cce 100644 --- a/src/renderer/prefComponents/markdown/index.vue +++ b/src/renderer/prefComponents/markdown/index.vue @@ -54,6 +54,12 @@ :onChange="value => onSelectChange('superSubScript', value)" more="https://pandoc.org/MANUAL.html#superscripts-and-subscripts" > + @@ -95,7 +101,8 @@ export default { tabSize: state => state.preferences.tabSize, listIndentation: state => state.preferences.listIndentation, frontmatterType: state => state.preferences.frontmatterType, - superSubScript: state => state.preferences.superSubScript + superSubScript: state => state.preferences.superSubScript, + footnote: state => state.preferences.footnote }) }, methods: { diff --git a/src/renderer/store/preferences.js b/src/renderer/store/preferences.js index c0bbef20..1635ac0e 100644 --- a/src/renderer/store/preferences.js +++ b/src/renderer/store/preferences.js @@ -41,6 +41,7 @@ const state = { listIndentation: 1, frontmatterType: '-', superSubScript: false, + footnote: false, theme: 'light', diff --git a/static/preference.json b/static/preference.json index 1364bf47..049c2dc5 100644 --- a/static/preference.json +++ b/static/preference.json @@ -38,6 +38,7 @@ "listIndentation": 1, "frontmatterType": "-", "superSubScript": false, + "footnote": false, "theme": "light",