Skip to content

Commit

Permalink
add support for markdown-it
Browse files Browse the repository at this point in the history
  • Loading branch information
thawk committed Jul 5, 2022
1 parent fcc340e commit 2d24e9c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions examples/markdown/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
# Markdown.js

* Provided by [Markdown.js](https://github.com/evilstreak/markdown-js) in [extras/](https://github.com/impress/impress.js/tree/master/extras)
* [markdown-it](https://github.com/markdown-it/markdown-it) and [marked](https://github.com/markedjs/marked)
is also supported
* Jot down your bullet points in *Markdown* & have it automatically converted to HTML
* Note: The Markdown is converted into a presentation client side, in the browser. This is unlike
existing tools like [Hovercraft](https://github.com/regebro/hovercraft) and
Expand Down Expand Up @@ -183,6 +185,7 @@ <h1>CSS &amp; JavaScript magic</h1>
<script type="text/javascript" src="../../extras/mermaid/mermaid.min.js"></script>
<script type="text/javascript" src="../../extras/markdown/markdown.js"></script>
<!-- <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script> -->
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/markdown-it/13.0.1/markdown-it.min.js"></script> -->

<!--
To make all described above really work, you need to include impress.js in the page.
Expand Down
7 changes: 7 additions & 0 deletions js/impress.js
Original file line number Diff line number Diff line change
Expand Up @@ -2041,6 +2041,13 @@
return function( elem, src ) {
return marked.parse( src );
};
} else if ( window.hasOwnProperty( "markdownit" ) ) {

// Using markdown-it
var md = markdownit();
return function( elem, src ) {
return md.render( src );
};
} else if ( window.hasOwnProperty( "markdown" ) ) {

// Using builtin markdown engine
Expand Down
7 changes: 7 additions & 0 deletions src/plugins/extras/extras.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@
return function( elem, src ) {
return marked.parse( src );
};
} else if ( window.hasOwnProperty( "markdownit" ) ) {

// Using markdown-it
var md = markdownit();
return function( elem, src ) {
return md.render( src );
};
} else if ( window.hasOwnProperty( "markdown" ) ) {

// Using builtin markdown engine
Expand Down

0 comments on commit 2d24e9c

Please sign in to comment.