From 20d7c87a2f967004a4ef42f6389f8127f50ef546 Mon Sep 17 00:00:00 2001 From: Nico Jansen Date: Tue, 6 Jul 2021 18:19:10 +0200 Subject: [PATCH] fix(highlight): allow pre fragments --- plugin/highlight/plugin.js | 2 +- test/test-markdown.html | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/plugin/highlight/plugin.js b/plugin/highlight/plugin.js index ff2ac8b2..f31e1a29 100644 --- a/plugin/highlight/plugin.js +++ b/plugin/highlight/plugin.js @@ -35,7 +35,7 @@ const Plugin = { Array.from( reveal.getRevealElement().querySelectorAll( 'pre code' ) ).forEach( block => { - block.parentNode.className = 'code-wrapper'; + block.parentNode.classList.add('code-wrapper'); // Code can optionally be wrapped in script template to avoid // HTML being parsed by the browser (i.e. when you need to diff --git a/test/test-markdown.html b/test/test-markdown.html index d79246c9..d6d48584 100644 --- a/test/test-markdown.html +++ b/test/test-markdown.html @@ -281,6 +281,15 @@ ``` +
+ +
@@ -453,6 +462,11 @@ assert.strictEqual( deck6.getRevealElement().querySelectorAll( '.with-line-highlights-and-lanugage .hljs.javascript[data-line-numbers="1,2,3"]' ).length, 1 ); }); + + QUnit.test( '```block should allow custom fragment', function( assert ) { + assert.strictEqual( deck5.getRevealElement().querySelectorAll( '.with-code-in-fragment pre.fragment' ).length, 1 ); + }); + } ); deck1.initialize();