Merge pull request #2956 from ryzokuken/plugin-markdown
markdown plugin improvements
This commit is contained in:
commit
2c115b887a
@ -421,6 +421,9 @@ const Plugin = () => {
|
|||||||
|
|
||||||
deck = reveal;
|
deck = reveal;
|
||||||
|
|
||||||
|
let { renderer, animateLists, ...markedOptions } = deck.getConfig().markdown;
|
||||||
|
|
||||||
|
if (!renderer) {
|
||||||
let renderer = new marked.Renderer();
|
let renderer = new marked.Renderer();
|
||||||
|
|
||||||
renderer.code = ( code, language ) => {
|
renderer.code = ( code, language ) => {
|
||||||
@ -445,10 +448,15 @@ const Plugin = () => {
|
|||||||
|
|
||||||
return `<pre><code ${lineNumbers} class="${language}">${code}</code></pre>`;
|
return `<pre><code ${lineNumbers} class="${language}">${code}</code></pre>`;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (animateLists) {
|
||||||
|
renderer.listitem = (text) => `<li class="fragment">${text}</li>`;
|
||||||
|
}
|
||||||
|
|
||||||
marked.setOptions( {
|
marked.setOptions( {
|
||||||
renderer,
|
renderer,
|
||||||
...deck.getConfig().markdown
|
...markedOptions
|
||||||
} );
|
} );
|
||||||
|
|
||||||
return processSlides( deck.getRevealElement() ).then( convertSlides );
|
return processSlides( deck.getRevealElement() ).then( convertSlides );
|
||||||
|
Loading…
Reference in New Issue
Block a user