Gathering detailed insights and metrics for showdown-highlight
Gathering detailed insights and metrics for showdown-highlight
Gathering detailed insights and metrics for showdown-highlight
Gathering detailed insights and metrics for showdown-highlight
🎨 A Showdown extension for highlighting code blocks.
npm install showdown-highlight
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
1,334,009
Last Day
1,184
Last Week
7,222
Last Month
30,451
Last Year
347,283
MIT License
54 Stars
83 Commits
18 Forks
2 Watchers
1 Branches
10 Contributors
Updated on Feb 17, 2025
Minified
Minified + Gzipped
Latest Version
3.1.0
Package Id
showdown-highlight@3.1.0
Unpacked Size
9.65 kB
Size
3.82 kB
File Count
5
NPM Version
8.13.2
Node Version
18.6.0
Cumulative downloads
Total Downloads
Last Day
-0.3%
1,184
Compared to previous day
Last Week
4.6%
7,222
Compared to previous week
Last Month
-8.8%
30,451
Compared to previous month
Last Year
18.1%
347,283
Compared to previous year
3
1
A Showdown extension for highlight the code blocks.
This package uses highlight.js
to highlight code blocks in Showdown output. :rocket:
1# Using npm 2npm install --save showdown-highlight 3 4# Using yarn 5yarn add showdown-highlight
1const showdown = require('showdown')
2 , showdownHighlight = require("showdown-highlight")
3 ;
4
5// After requiring the module, use it as extension
6let converter = new showdown.Converter({
7 // That's it
8 extensions: [showdownHighlight({
9 // Whether to add the classes to the <pre> tag, default is false
10 pre: true
11 // Whether to use hljs' auto language detection, default is true
12 , auto_detection: true
13 })]
14});
15
16// Now you can Highlight code blocks
17let html = converter.makeHtml(`
18## Highlighting Code with Showdown
19
20Below we have a piece of JavaScript code:
21
22\`\`\`js
23function sayHello (msg, who) {
24 return \`\${who} says: msg\`;
25}
26sayHello("Hello World", "Johnny");
27\`\`\`
28`);
29
30console.log(html);
31// <h2 id="highlightingcodewithshowdown">Highlighting Code with Showdown</h2>
32//
33// <p>Below we have a piece of JavaScript code:</p>
34//
35// <pre><code class="js language-js"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">sayHello</span> (<span class="hljs-params">msg, who</span>) </span>{
36// <span class="hljs-keyword">return</span> <span class="hljs-string">`<span class="hljs-subst">${who}</span> says: msg`</span>;
37// }
38// sayHello(<span class="hljs-string">"Hello World"</span>, <span class="hljs-string">"Johnny"</span>);
39// </code></pre>
There are few ways to get help:
showdownHighlight()
Highlight the code in the showdown input.
Examples:
1let converter = new showdown.Converter({
2 extensions: [showdownHighlight]
3})
Enable the classes in the <pre>
element:
1let converter = new showdown.Converter({ 2 extensions: [showdownHighlight({ pre: true })] 3})
If you want to disable language auto detection
feature of hljs, change auto_detection
flag as false
. With this option
turned off, showdown-highlight
will not process any codeblocks with no
language specified.
1let converter = new showdown.Converter({ 2 extensions: [showdownHighlight({ auto_detection: false })] 3})
Have an idea? Found a bug? See how to contribute.
If you are using this library in one of your projects, add it in this list. :sparkles:
mdpdf
bloggify-markdown-highlight
github-readme-to-html
md-toy-blog
@kev_nz/publisher
@etermind/alex
@siradoc/siradoc
@web-native-js/chtml-cli
swanky
md-srv
docset-tools-markdown
callete
teroshdl2
ui_kitchenadmincenter
trumpdoc
@peersky/next-web3-chakra
mdpdf_jm
textbase
teroshdl
showdown-html
busi-ui
md-browse
markdown2dash
tutors-reader-lib
tutors-html-beta
tutors-html
examma-ray
steelsky
chimpsky
ember-showdown-highlight
showit
tutors-html-alpha
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 3/12 approved changesets -- score normalized to 2
Reason
1 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 1
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-05-05
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More