Browse Source

lint: remove key spacing

pull/979/head
Vitaly Puzrin 5 months 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:
camelcase: 0
key-spacing: 0
no-multi-spaces: 0

8
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'
})

24
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 (<br />)
breaks: false, // Convert '\n' in paragraphs into <br>
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 (<br />)
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
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: {

25
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 (<br />)
breaks: false, // Convert '\n' in paragraphs into <br>
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 (<br />)
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
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: {}

24
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 (<br />)
breaks: false, // Convert '\n' in paragraphs into <br>
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 (<br />)
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
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: {

8
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
})
}

8
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
})
}

25
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 (<br />)
breaks: false, // Convert '\n' in paragraphs into <br>
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 (<br />)
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: 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) {

Loading…
Cancel
Save