feat: add footnote setting option

This commit is contained in:
罗冉 2019-10-29 18:36:16 +08:00
parent b4788f559a
commit 318bfc6aa2
9 changed files with 28 additions and 3 deletions

View File

@ -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

View File

@ -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",

View File

@ -277,7 +277,7 @@ export const MUYA_DEFAULT_OPTION = {
// Markdown extensions
superSubScript: false,
footnote: true
footnote: false
}
// export const DIAGRAM_TEMPLATE = {

View File

@ -29,5 +29,5 @@ export default {
math: true,
frontMatter: true,
superSubScript: false,
footnote: true
footnote: false
}

View File

@ -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) {

View File

@ -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,

View File

@ -54,6 +54,12 @@
:onChange="value => onSelectChange('superSubScript', value)"
more="https://pandoc.org/MANUAL.html#superscripts-and-subscripts"
></bool>
<bool
description="Enable pandoc's markdown extension footnote(need restart Mark Text)."
:bool="footnote"
:onChange="value => onSelectChange('footnote', value)"
more="https://pandoc.org/MANUAL.html#footnotes"
></bool>
</div>
</template>
@ -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: {

View File

@ -41,6 +41,7 @@ const state = {
listIndentation: 1,
frontmatterType: '-',
superSubScript: false,
footnote: false,
theme: 'light',

View File

@ -38,6 +38,7 @@
"listIndentation": 1,
"frontmatterType": "-",
"superSubScript": false,
"footnote": false,
"theme": "light",