Skip to content

Commit

Permalink
Use langPrefix from Markdown-it options instead of hardcoded value 'l…
Browse files Browse the repository at this point in the history
…anguage-'

Markdown-it has an option called `langPrefix` for the same propose which defaults to `language-`.

Default `language-` prefix value follows W3C recommendation.

Highlight.js default behavior adds language to class list without any prefix (same as setting `langPrefix = ''` in md options).
  • Loading branch information
vfcp committed Jul 16, 2020
1 parent 437acd2 commit 5b77dca
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Expand Up @@ -49,7 +49,7 @@ function inlineCodeRenderer (tokens, idx, options) {
}

const highlighted = options.highlight(code.content, lang)
const cls = lang ? ` class="language-${lang}"` : ''
const cls = lang ? ` class="${options.langPrefix + lang}"` : ''

return `<code${cls}>${highlighted}</code>`
}
Expand Down

0 comments on commit 5b77dca

Please sign in to comment.