From 9f5e9c606917346564150de3259978501716ea86 Mon Sep 17 00:00:00 2001 From: Vitaly Puzrin Date: Sat, 2 Dec 2023 04:25:52 +0200 Subject: [PATCH] lint: remove key spacing --- .eslintrc.yml | 1 - bin/markdown-it.mjs | 8 ++++---- lib/presets/commonmark.mjs | 24 +++++++++++++++++------- lib/presets/default.mjs | 25 +++++++++++++++++-------- lib/presets/zero.mjs | 24 +++++++++++++++++------- lib/rules_inline/emphasis.mjs | 8 ++++---- lib/rules_inline/strikethrough.mjs | 8 ++++---- support/demo_template/index.mjs | 25 ++++++++++++++++++------- 8 files changed, 81 insertions(+), 42 deletions(-) diff --git a/.eslintrc.yml b/.eslintrc.yml index d4d359b..457b2fc 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -19,5 +19,4 @@ ignorePatterns: rules: camelcase: 0 - key-spacing: 0 no-multi-spaces: 0 diff --git a/bin/markdown-it.mjs b/bin/markdown-it.mjs index 0a8e4f0..84626f1 100755 --- a/bin/markdown-it.mjs +++ b/bin/markdown-it.mjs @@ -16,22 +16,22 @@ cli.add_argument('-v', '--version', { }) cli.add_argument('--no-html', { - help: 'Disable embedded HTML', + help: 'Disable embedded HTML', action: 'store_true' }) cli.add_argument('-l', '--linkify', { - help: 'Autolink text', + help: 'Autolink text', action: 'store_true' }) cli.add_argument('-t', '--typographer', { - help: 'Enable smartquotes and other typographic replacements', + help: 'Enable smartquotes and other typographic replacements', action: 'store_true' }) cli.add_argument('--trace', { - help: 'Show stack trace on error', + help: 'Show stack trace on error', action: 'store_true' }) diff --git a/lib/presets/commonmark.mjs b/lib/presets/commonmark.mjs index 84e8f79..7e705ad 100644 --- a/lib/presets/commonmark.mjs +++ b/lib/presets/commonmark.mjs @@ -2,14 +2,23 @@ export default { options: { - html: true, // Enable HTML tags in source - xhtmlOut: true, // Use '/' to close single tags (
) - breaks: false, // Convert '\n' in paragraphs into
- langPrefix: 'language-', // CSS language prefix for fenced blocks - linkify: false, // autoconvert URL-like texts to links + // Enable HTML tags in source + html: true, + + // Use '/' to close single tags (
) + xhtmlOut: true, + + // Convert '\n' in paragraphs into
+ breaks: false, + + // CSS language prefix for fenced blocks + langPrefix: 'language-', + + // autoconvert URL-like texts to links + linkify: false, // Enable some language-neutral replacements + quotes beautification - typographer: false, + typographer: false, // Double + single quotes replacement pairs, when typographer enabled, // and smartquotes on. Could be either a String or an Array. @@ -26,7 +35,8 @@ export default { // highlight: null, - maxNesting: 20 // Internal protection, recursion limit + // Internal protection, recursion limit + maxNesting: 20 }, components: { diff --git a/lib/presets/default.mjs b/lib/presets/default.mjs index 24473ff..2540207 100644 --- a/lib/presets/default.mjs +++ b/lib/presets/default.mjs @@ -2,14 +2,23 @@ export default { options: { - html: false, // Enable HTML tags in source - xhtmlOut: false, // Use '/' to close single tags (
) - breaks: false, // Convert '\n' in paragraphs into
- langPrefix: 'language-', // CSS language prefix for fenced blocks - linkify: false, // autoconvert URL-like texts to links + // Enable HTML tags in source + html: false, + + // Use '/' to close single tags (
) + xhtmlOut: false, + + // Convert '\n' in paragraphs into
+ breaks: false, + + // CSS language prefix for fenced blocks + langPrefix: 'language-', + + // autoconvert URL-like texts to links + linkify: false, // Enable some language-neutral replacements + quotes beautification - typographer: false, + typographer: false, // Double + single quotes replacement pairs, when typographer enabled, // and smartquotes on. Could be either a String or an Array. @@ -26,11 +35,11 @@ export default { // highlight: null, - maxNesting: 100 // Internal protection, recursion limit + // Internal protection, recursion limit + maxNesting: 100 }, components: { - core: {}, block: {}, inline: {} diff --git a/lib/presets/zero.mjs b/lib/presets/zero.mjs index 8aab711..c83a48e 100644 --- a/lib/presets/zero.mjs +++ b/lib/presets/zero.mjs @@ -3,14 +3,23 @@ export default { options: { - html: false, // Enable HTML tags in source - xhtmlOut: false, // Use '/' to close single tags (
) - breaks: false, // Convert '\n' in paragraphs into
- langPrefix: 'language-', // CSS language prefix for fenced blocks - linkify: false, // autoconvert URL-like texts to links + // Enable HTML tags in source + html: false, + + // Use '/' to close single tags (
) + xhtmlOut: false, + + // Convert '\n' in paragraphs into
+ breaks: false, + + // CSS language prefix for fenced blocks + langPrefix: 'language-', + + // autoconvert URL-like texts to links + linkify: false, // Enable some language-neutral replacements + quotes beautification - typographer: false, + typographer: false, // Double + single quotes replacement pairs, when typographer enabled, // and smartquotes on. Could be either a String or an Array. @@ -27,7 +36,8 @@ export default { // highlight: null, - maxNesting: 20 // Internal protection, recursion limit + // Internal protection, recursion limit + maxNesting: 20 }, components: { diff --git a/lib/rules_inline/emphasis.mjs b/lib/rules_inline/emphasis.mjs index f259255..4e3b273 100644 --- a/lib/rules_inline/emphasis.mjs +++ b/lib/rules_inline/emphasis.mjs @@ -28,18 +28,18 @@ function emphasis_tokenize (state, silent) { // A position of the token this delimiter corresponds to. // - token: state.tokens.length - 1, + token: state.tokens.length - 1, // If this delimiter is matched as a valid opener, `end` will be // equal to its position, otherwise it's `-1`. // - end: -1, + end: -1, // Boolean flags that determine if this delimiter could open or close // an emphasis. // - open: scanned.can_open, - close: scanned.can_close + open: scanned.can_open, + close: scanned.can_close }) } diff --git a/lib/rules_inline/strikethrough.mjs b/lib/rules_inline/strikethrough.mjs index ec52e29..45f3c1b 100644 --- a/lib/rules_inline/strikethrough.mjs +++ b/lib/rules_inline/strikethrough.mjs @@ -32,10 +32,10 @@ function strikethrough_tokenize (state, silent) { state.delimiters.push({ marker, length: 0, // disable "rule of 3" length checks meant for emphasis - token: state.tokens.length - 1, - end: -1, - open: scanned.can_open, - close: scanned.can_close + token: state.tokens.length - 1, + end: -1, + open: scanned.can_open, + close: scanned.can_close }) } diff --git a/support/demo_template/index.mjs b/support/demo_template/index.mjs index 0ba8bf1..0926de1 100644 --- a/support/demo_template/index.mjs +++ b/support/demo_template/index.mjs @@ -18,17 +18,28 @@ import md_sup from 'markdown-it-sup' let mdHtml, mdSrc, permalink, scrollMap const defaults = { - html: false, // Enable HTML tags in source - xhtmlOut: false, // Use '/' to close single tags (
) - breaks: false, // Convert '\n' in paragraphs into
- langPrefix: 'language-', // CSS language prefix for fenced blocks - linkify: true, // autoconvert URL-like texts to links - typographer: true, // Enable smartypants and other sweet transforms + // Enable HTML tags in source + html: false, + + // Use '/' to close single tags (
) + xhtmlOut: false, + + // Convert '\n' in paragraphs into
+ breaks: false, + + // CSS language prefix for fenced blocks + langPrefix: 'language-', + + // autoconvert URL-like texts to links + linkify: true, + + // Enable smartypants and other sweet transforms + typographer: true, // options below are for demo only _highlight: true, _strict: false, - _view: 'html' // html / src / debug + _view: 'html' // html / src / debug } defaults.highlight = function (str, lang) {