improve renderer option handling
Don't waste time constructing a renderer then override it if one is passed into the options object.
This commit is contained in:
parent
cf8e64bd85
commit
6884741b94
|
@ -424,6 +424,9 @@ const Plugin = () => {
|
|||
|
||||
deck = reveal;
|
||||
|
||||
let { renderer, ...markedOptions } = deck.getConfig().markdown;
|
||||
|
||||
if (!renderer) {
|
||||
let renderer = new marked.Renderer();
|
||||
|
||||
renderer.code = ( code, language ) => {
|
||||
|
@ -448,10 +451,11 @@ const Plugin = () => {
|
|||
|
||||
return `<pre><code ${lineNumbers} class="${language}">${code}</code></pre>`;
|
||||
};
|
||||
}
|
||||
|
||||
marked.setOptions( {
|
||||
renderer,
|
||||
...deck.getConfig().markdown
|
||||
...markedOptions
|
||||
} );
|
||||
|
||||
return processSlides( deck.getRevealElement() ).then( convertSlides );
|
||||
|
|
Loading…
Reference in New Issue