Package Exports
- showdown-highlight
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (showdown-highlight) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
$ showdown-highlight
A Showdown extension for highlight the code blocks.
☁️ Installation
You can install the package globally and use it as command line tool:
$ npm i -g showdown-highlightThen, run showdown-highlight --help and see what the CLI tool can do.
$ showdown-highlight --help
Usage: showdown-highlight [options]
A Showdown extension for highlight the code blocks.
Options:
-f, --foo <foo> Dummy argument
-v, --version Displays version information.
-h, --help Displays this help.
Documentation can be found at https://github.com/IonicaBizau/showdown-highlight#readme.📋 Example
Here is an example how to use this package as library. To install it locally, as library, you can do that using npm:
$ npm i --save showdown-highlightconst showdown = require('showdown')
, showdownHighlight = require("showdown-highlight")
;
// After requiring the module, use it as extension
let converter = new showdown.Converter({
extensions: [showdownHighlight]
});
// Now you can Highlight code blocks
let html = converter.makeHtml(`
## Highlighting Code with Showdown
Below we have a piece of JavaScript code:
\`\`\`js
function sayHello (msg, who) {
return \`\${who} says: msg\`;
}
sayHello("Hello World", "Johnny");
\`\`\`
`);
console.log(html);
// <h2 id="highlightingcodewithshowdown">Highlighting Code with Showdown</h2>
//
// <p>Below we have a piece of JavaScript code:</p>
//
// <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>{
// <span class="hljs-keyword">return</span> <span class="hljs-string">`<span class="hljs-subst">${who}</span> says: msg`</span>;
// }
// sayHello(<span class="hljs-string">"Hello World"</span>, <span class="hljs-string">"Johnny"</span>);
// </code></pre>📝 Documentation
For full API reference, see the DOCUMENTATION.md file.
😋 How to contribute
Have an idea? Found a bug? See how to contribute.
💰 Donations
Another way to support the development of my open-source modules is to set up a recurring donation, via Patreon. 🚀
PayPal donations are appreciated too! Each dollar helps.
Thanks! ❤️