Skip to content

Commit

Permalink
lint: remove key spacing
Browse files Browse the repository at this point in the history
  • Loading branch information
puzrin committed Dec 2, 2023
1 parent 8b815a6 commit 9f5e9c6
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 42 deletions.
1 change: 0 additions & 1 deletion .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,4 @@ ignorePatterns:

rules:
camelcase: 0
key-spacing: 0
no-multi-spaces: 0
8 changes: 4 additions & 4 deletions bin/markdown-it.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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'
})

Expand Down
24 changes: 17 additions & 7 deletions lib/presets/commonmark.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -26,7 +35,8 @@ export default {
//
highlight: null,

maxNesting: 20 // Internal protection, recursion limit
// Internal protection, recursion limit
maxNesting: 20
},

components: {
Expand Down
25 changes: 17 additions & 8 deletions lib/presets/default.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -26,11 +35,11 @@ export default {
//
highlight: null,

maxNesting: 100 // Internal protection, recursion limit
// Internal protection, recursion limit
maxNesting: 100
},

components: {

core: {},
block: {},
inline: {}
Expand Down
24 changes: 17 additions & 7 deletions lib/presets/zero.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -27,7 +36,8 @@ export default {
//
highlight: null,

maxNesting: 20 // Internal protection, recursion limit
// Internal protection, recursion limit
maxNesting: 20
},

components: {
Expand Down
8 changes: 4 additions & 4 deletions lib/rules_inline/emphasis.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
}

Expand Down
8 changes: 4 additions & 4 deletions lib/rules_inline/strikethrough.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
}

Expand Down
25 changes: 18 additions & 7 deletions support/demo_template/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 9f5e9c6

Please sign in to comment.