1
0
Fork 0

Merge pull request #2956 from ryzokuken/plugin-markdown

markdown plugin improvements
This commit is contained in:
Hakim El Hattab 2021-05-17 09:54:24 +02:00 committed by GitHub
commit 2c115b887a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 28 additions and 20 deletions

View File

@ -421,6 +421,9 @@ const Plugin = () => {
deck = reveal;
let { renderer, animateLists, ...markedOptions } = deck.getConfig().markdown;
if (!renderer) {
let renderer = new marked.Renderer();
renderer.code = ( code, language ) => {
@ -445,10 +448,15 @@ const Plugin = () => {
return `<pre><code ${lineNumbers} class="${language}">${code}</code></pre>`;
};
}
if (animateLists) {
renderer.listitem = (text) => `<li class="fragment">${text}</li>`;
}
marked.setOptions( {
renderer,
...deck.getConfig().markdown
...markedOptions
} );
return processSlides( deck.getRevealElement() ).then( convertSlides );