Browse Source

lint: remove key spacing

pull/979/head
Vitaly Puzrin 1 year ago
parent
commit
9f5e9c6069
  1. 1
      .eslintrc.yml
  2. 8
      bin/markdown-it.mjs
  3. 24
      lib/presets/commonmark.mjs
  4. 25
      lib/presets/default.mjs
  5. 24
      lib/presets/zero.mjs
  6. 8
      lib/rules_inline/emphasis.mjs
  7. 8
      lib/rules_inline/strikethrough.mjs
  8. 25
      support/demo_template/index.mjs

1
.eslintrc.yml

@ -19,5 +19,4 @@ ignorePatterns:
rules: rules:
camelcase: 0 camelcase: 0
key-spacing: 0
no-multi-spaces: 0 no-multi-spaces: 0

8
bin/markdown-it.mjs

@ -16,22 +16,22 @@ cli.add_argument('-v', '--version', {
}) })
cli.add_argument('--no-html', { cli.add_argument('--no-html', {
help: 'Disable embedded HTML', help: 'Disable embedded HTML',
action: 'store_true' action: 'store_true'
}) })
cli.add_argument('-l', '--linkify', { cli.add_argument('-l', '--linkify', {
help: 'Autolink text', help: 'Autolink text',
action: 'store_true' action: 'store_true'
}) })
cli.add_argument('-t', '--typographer', { cli.add_argument('-t', '--typographer', {
help: 'Enable smartquotes and other typographic replacements', help: 'Enable smartquotes and other typographic replacements',
action: 'store_true' action: 'store_true'
}) })
cli.add_argument('--trace', { cli.add_argument('--trace', {
help: 'Show stack trace on error', help: 'Show stack trace on error',
action: 'store_true' action: 'store_true'
}) })

24
lib/presets/commonmark.mjs

@ -2,14 +2,23 @@
export default { export default {
options: { options: {
html: true, // Enable HTML tags in source // Enable HTML tags in source
xhtmlOut: true, // Use '/' to close single tags (<br />) html: true,
breaks: false, // Convert '\n' in paragraphs into <br>
langPrefix: 'language-', // CSS language prefix for fenced blocks // Use '/' to close single tags (<br />)
linkify: false, // autoconvert URL-like texts to links xhtmlOut: true,
// Convert '\n' in paragraphs into <br>
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 // Enable some language-neutral replacements + quotes beautification
typographer: false, typographer: false,
// Double + single quotes replacement pairs, when typographer enabled, // Double + single quotes replacement pairs, when typographer enabled,
// and smartquotes on. Could be either a String or an Array. // and smartquotes on. Could be either a String or an Array.
@ -26,7 +35,8 @@ export default {
// //
highlight: null, highlight: null,
maxNesting: 20 // Internal protection, recursion limit // Internal protection, recursion limit
maxNesting: 20
}, },
components: { components: {

25
lib/presets/default.mjs

@ -2,14 +2,23 @@
export default { export default {
options: { options: {
html: false, // Enable HTML tags in source // Enable HTML tags in source
xhtmlOut: false, // Use '/' to close single tags (<br />) html: false,
breaks: false, // Convert '\n' in paragraphs into <br>
langPrefix: 'language-', // CSS language prefix for fenced blocks // Use '/' to close single tags (<br />)
linkify: false, // autoconvert URL-like texts to links xhtmlOut: false,
// Convert '\n' in paragraphs into <br>
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 // Enable some language-neutral replacements + quotes beautification
typographer: false, typographer: false,
// Double + single quotes replacement pairs, when typographer enabled, // Double + single quotes replacement pairs, when typographer enabled,
// and smartquotes on. Could be either a String or an Array. // and smartquotes on. Could be either a String or an Array.
@ -26,11 +35,11 @@ export default {
// //
highlight: null, highlight: null,
maxNesting: 100 // Internal protection, recursion limit // Internal protection, recursion limit
maxNesting: 100
}, },
components: { components: {
core: {}, core: {},
block: {}, block: {},
inline: {} inline: {}

24
lib/presets/zero.mjs

@ -3,14 +3,23 @@
export default { export default {
options: { options: {
html: false, // Enable HTML tags in source // Enable HTML tags in source
xhtmlOut: false, // Use '/' to close single tags (<br />) html: false,
breaks: false, // Convert '\n' in paragraphs into <br>
langPrefix: 'language-', // CSS language prefix for fenced blocks // Use '/' to close single tags (<br />)
linkify: false, // autoconvert URL-like texts to links xhtmlOut: false,
// Convert '\n' in paragraphs into <br>
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 // Enable some language-neutral replacements + quotes beautification
typographer: false, typographer: false,
// Double + single quotes replacement pairs, when typographer enabled, // Double + single quotes replacement pairs, when typographer enabled,
// and smartquotes on. Could be either a String or an Array. // and smartquotes on. Could be either a String or an Array.
@ -27,7 +36,8 @@ export default {
// //
highlight: null, highlight: null,
maxNesting: 20 // Internal protection, recursion limit // Internal protection, recursion limit
maxNesting: 20
}, },
components: { components: {

8
lib/rules_inline/emphasis.mjs

@ -28,18 +28,18 @@ function emphasis_tokenize (state, silent) {
// A position of the token this delimiter corresponds to. // 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 // If this delimiter is matched as a valid opener, `end` will be
// equal to its position, otherwise it's `-1`. // equal to its position, otherwise it's `-1`.
// //
end: -1, end: -1,
// Boolean flags that determine if this delimiter could open or close // Boolean flags that determine if this delimiter could open or close
// an emphasis. // an emphasis.
// //
open: scanned.can_open, open: scanned.can_open,
close: scanned.can_close close: scanned.can_close
}) })
} }

8
lib/rules_inline/strikethrough.mjs

@ -32,10 +32,10 @@ function strikethrough_tokenize (state, silent) {
state.delimiters.push({ state.delimiters.push({
marker, marker,
length: 0, // disable "rule of 3" length checks meant for emphasis length: 0, // disable "rule of 3" length checks meant for emphasis
token: state.tokens.length - 1, token: state.tokens.length - 1,
end: -1, end: -1,
open: scanned.can_open, open: scanned.can_open,
close: scanned.can_close close: scanned.can_close
}) })
} }

25
support/demo_template/index.mjs

@ -18,17 +18,28 @@ import md_sup from 'markdown-it-sup'
let mdHtml, mdSrc, permalink, scrollMap let mdHtml, mdSrc, permalink, scrollMap
const defaults = { const defaults = {
html: false, // Enable HTML tags in source // Enable HTML tags in source
xhtmlOut: false, // Use '/' to close single tags (<br />) html: false,
breaks: false, // Convert '\n' in paragraphs into <br>
langPrefix: 'language-', // CSS language prefix for fenced blocks // Use '/' to close single tags (<br />)
linkify: true, // autoconvert URL-like texts to links xhtmlOut: false,
typographer: true, // Enable smartypants and other sweet transforms
// Convert '\n' in paragraphs into <br>
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 // options below are for demo only
_highlight: true, _highlight: true,
_strict: false, _strict: false,
_view: 'html' // html / src / debug _view: 'html' // html / src / debug
} }
defaults.highlight = function (str, lang) { defaults.highlight = function (str, lang) {

Loading…
Cancel
Save