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 | | 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) | | frontmatterType | String | `-` | The frontmatter type: `-` (YAML), `+` (TOML), `;` (JSON) or `{` (JSON) |
| superSubScript | Boolean | `false` | Enable pandoc's markdown extension superscript and subscript. | | superSubScript | Boolean | `false` | Enable pandoc's markdown extension superscript and subscript. |
| footnote | Boolean | `false` | Enable pandoc's markdown extension footnote |
#### Theme #### Theme

View File

@ -237,6 +237,11 @@
"type": "boolean", "type": "boolean",
"default": false "default": false
}, },
"footnote": {
"description": "Markdown-Enable pandoc's markdown extension footnote.",
"type": "boolean",
"default": false
},
"theme": { "theme": {
"description": "Theme--Select the theme used in Mark Text", "description": "Theme--Select the theme used in Mark Text",

View File

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

View File

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

View File

@ -107,6 +107,7 @@ class ExportHtml {
this.mathRendererCalled = false this.mathRendererCalled = false
let html = marked(this.markdown, { let html = marked(this.markdown, {
superSubScript: this.muya ? this.muya.options.superSubScript : false, superSubScript: this.muya ? this.muya.options.superSubScript : false,
footnote: this.muya ? this.muya.options.footnote : false,
highlight (code, lang) { highlight (code, lang) {
// Language may be undefined (GH#591) // Language may be undefined (GH#591)
if (!lang) { if (!lang) {

View File

@ -137,6 +137,7 @@ export default {
listIndentation: state => state.preferences.listIndentation, listIndentation: state => state.preferences.listIndentation,
frontmatterType: state => state.preferences.frontmatterType, frontmatterType: state => state.preferences.frontmatterType,
superSubScript: state => state.preferences.superSubScript, superSubScript: state => state.preferences.superSubScript,
footnote: state => state.preferences.footnote,
lineHeight: state => state.preferences.lineHeight, lineHeight: state => state.preferences.lineHeight,
fontSize: state => state.preferences.fontSize, fontSize: state => state.preferences.fontSize,
codeFontSize: state => state.preferences.codeFontSize, codeFontSize: state => state.preferences.codeFontSize,
@ -251,6 +252,12 @@ export default {
editor.setOptions({ superSubScript: value }, true) 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) { hideQuickInsertHint: function (value, oldValue) {
const { editor } = this const { editor } = this
if (value !== oldValue && editor) { if (value !== oldValue && editor) {
@ -447,6 +454,7 @@ export default {
listIndentation, listIndentation,
frontmatterType, frontmatterType,
superSubScript, superSubScript,
footnote,
hideQuickInsertHint, hideQuickInsertHint,
editorLineWidth, editorLineWidth,
theme, theme,
@ -490,6 +498,7 @@ export default {
listIndentation, listIndentation,
frontmatterType, frontmatterType,
superSubScript, superSubScript,
footnote,
hideQuickInsertHint, hideQuickInsertHint,
hideLinkPopup, hideLinkPopup,
spellcheckEnabled: spellcheckerEnabled, spellcheckEnabled: spellcheckerEnabled,

View File

@ -54,6 +54,12 @@
:onChange="value => onSelectChange('superSubScript', value)" :onChange="value => onSelectChange('superSubScript', value)"
more="https://pandoc.org/MANUAL.html#superscripts-and-subscripts" more="https://pandoc.org/MANUAL.html#superscripts-and-subscripts"
></bool> ></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> </div>
</template> </template>
@ -95,7 +101,8 @@ export default {
tabSize: state => state.preferences.tabSize, tabSize: state => state.preferences.tabSize,
listIndentation: state => state.preferences.listIndentation, listIndentation: state => state.preferences.listIndentation,
frontmatterType: state => state.preferences.frontmatterType, frontmatterType: state => state.preferences.frontmatterType,
superSubScript: state => state.preferences.superSubScript superSubScript: state => state.preferences.superSubScript,
footnote: state => state.preferences.footnote
}) })
}, },
methods: { methods: {

View File

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

View File

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