improve renderer option handling
Don't waste time constructing a renderer then override it if one is passed into the options object.edit
parent
cf8e64bd85
commit
6884741b94
|
@ -424,6 +424,9 @@ const Plugin = () => {
|
||||||
|
|
||||||
deck = reveal;
|
deck = reveal;
|
||||||
|
|
||||||
|
let { renderer, ...markedOptions } = deck.getConfig().markdown;
|
||||||
|
|
||||||
|
if (!renderer) {
|
||||||
let renderer = new marked.Renderer();
|
let renderer = new marked.Renderer();
|
||||||
|
|
||||||
renderer.code = ( code, language ) => {
|
renderer.code = ( code, language ) => {
|
||||||
|
@ -448,10 +451,11 @@ const Plugin = () => {
|
||||||
|
|
||||||
return `<pre><code ${lineNumbers} class="${language}">${code}</code></pre>`;
|
return `<pre><code ${lineNumbers} class="${language}">${code}</code></pre>`;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
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