replace deprecated hljs.highlightBlock calls, fix #2958
This commit is contained in:
parent
48024a1137
commit
c2fd760f8f
|
@ -196,6 +196,14 @@
|
|||
word-wrap: normal;
|
||||
}
|
||||
|
||||
.reveal .code-wrapper {
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
.reveal .code-wrapper code {
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
.reveal table {
|
||||
margin: auto;
|
||||
border-collapse: collapse;
|
||||
|
|
8
dist/theme/beige.css
vendored
8
dist/theme/beige.css
vendored
|
@ -236,6 +236,14 @@ section.has-dark-background, section.has-dark-background h1, section.has-dark-ba
|
|||
word-wrap: normal;
|
||||
}
|
||||
|
||||
.reveal .code-wrapper {
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
.reveal .code-wrapper code {
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
.reveal table {
|
||||
margin: auto;
|
||||
border-collapse: collapse;
|
||||
|
|
8
dist/theme/black.css
vendored
8
dist/theme/black.css
vendored
|
@ -229,6 +229,14 @@ section.has-light-background, section.has-light-background h1, section.has-light
|
|||
word-wrap: normal;
|
||||
}
|
||||
|
||||
.reveal .code-wrapper {
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
.reveal .code-wrapper code {
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
.reveal table {
|
||||
margin: auto;
|
||||
border-collapse: collapse;
|
||||
|
|
8
dist/theme/blood.css
vendored
8
dist/theme/blood.css
vendored
|
@ -235,6 +235,14 @@ section.has-light-background, section.has-light-background h1, section.has-light
|
|||
word-wrap: normal;
|
||||
}
|
||||
|
||||
.reveal .code-wrapper {
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
.reveal .code-wrapper code {
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
.reveal table {
|
||||
margin: auto;
|
||||
border-collapse: collapse;
|
||||
|
|
8
dist/theme/league.css
vendored
8
dist/theme/league.css
vendored
|
@ -238,6 +238,14 @@ section.has-light-background, section.has-light-background h1, section.has-light
|
|||
word-wrap: normal;
|
||||
}
|
||||
|
||||
.reveal .code-wrapper {
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
.reveal .code-wrapper code {
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
.reveal table {
|
||||
margin: auto;
|
||||
border-collapse: collapse;
|
||||
|
|
8
dist/theme/moon.css
vendored
8
dist/theme/moon.css
vendored
|
@ -237,6 +237,14 @@ section.has-light-background, section.has-light-background h1, section.has-light
|
|||
word-wrap: normal;
|
||||
}
|
||||
|
||||
.reveal .code-wrapper {
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
.reveal .code-wrapper code {
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
.reveal table {
|
||||
margin: auto;
|
||||
border-collapse: collapse;
|
||||
|
|
8
dist/theme/night.css
vendored
8
dist/theme/night.css
vendored
|
@ -230,6 +230,14 @@ section.has-light-background, section.has-light-background h1, section.has-light
|
|||
word-wrap: normal;
|
||||
}
|
||||
|
||||
.reveal .code-wrapper {
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
.reveal .code-wrapper code {
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
.reveal table {
|
||||
margin: auto;
|
||||
border-collapse: collapse;
|
||||
|
|
8
dist/theme/serif.css
vendored
8
dist/theme/serif.css
vendored
|
@ -233,6 +233,14 @@ section.has-dark-background, section.has-dark-background h1, section.has-dark-ba
|
|||
word-wrap: normal;
|
||||
}
|
||||
|
||||
.reveal .code-wrapper {
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
.reveal .code-wrapper code {
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
.reveal table {
|
||||
margin: auto;
|
||||
border-collapse: collapse;
|
||||
|
|
8
dist/theme/simple.css
vendored
8
dist/theme/simple.css
vendored
|
@ -232,6 +232,14 @@ section.has-dark-background, section.has-dark-background h1, section.has-dark-ba
|
|||
word-wrap: normal;
|
||||
}
|
||||
|
||||
.reveal .code-wrapper {
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
.reveal .code-wrapper code {
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
.reveal table {
|
||||
margin: auto;
|
||||
border-collapse: collapse;
|
||||
|
|
8
dist/theme/sky.css
vendored
8
dist/theme/sky.css
vendored
|
@ -240,6 +240,14 @@ section.has-dark-background, section.has-dark-background h1, section.has-dark-ba
|
|||
word-wrap: normal;
|
||||
}
|
||||
|
||||
.reveal .code-wrapper {
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
.reveal .code-wrapper code {
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
.reveal table {
|
||||
margin: auto;
|
||||
border-collapse: collapse;
|
||||
|
|
8
dist/theme/solarized.css
vendored
8
dist/theme/solarized.css
vendored
|
@ -233,6 +233,14 @@ html * {
|
|||
word-wrap: normal;
|
||||
}
|
||||
|
||||
.reveal .code-wrapper {
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
.reveal .code-wrapper code {
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
.reveal table {
|
||||
margin: auto;
|
||||
border-collapse: collapse;
|
||||
|
|
8
dist/theme/white.css
vendored
8
dist/theme/white.css
vendored
|
@ -229,6 +229,14 @@ section.has-dark-background, section.has-dark-background h1, section.has-dark-ba
|
|||
word-wrap: normal;
|
||||
}
|
||||
|
||||
.reveal .code-wrapper {
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
.reveal .code-wrapper code {
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
.reveal table {
|
||||
margin: auto;
|
||||
border-collapse: collapse;
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -29,11 +29,13 @@ const Plugin = {
|
|||
init: function( reveal ) {
|
||||
|
||||
// Read the plugin config options and provide fallbacks
|
||||
var config = reveal.getConfig().highlight || {};
|
||||
let config = reveal.getConfig().highlight || {};
|
||||
config.highlightOnLoad = typeof config.highlightOnLoad === 'boolean' ? config.highlightOnLoad : true;
|
||||
config.escapeHTML = typeof config.escapeHTML === 'boolean' ? config.escapeHTML : true;
|
||||
|
||||
[].slice.call( reveal.getRevealElement().querySelectorAll( 'pre code' ) ).forEach( function( block ) {
|
||||
Array.from( reveal.getRevealElement().querySelectorAll( 'pre code' ) ).forEach( block => {
|
||||
|
||||
block.parentNode.className = 'code-wrapper';
|
||||
|
||||
// Code can optionally be wrapped in script template to avoid
|
||||
// HTML being parsed by the browser (i.e. when you need to
|
||||
|
@ -56,7 +58,7 @@ const Plugin = {
|
|||
|
||||
// Re-highlight when focus is lost (for contenteditable code)
|
||||
block.addEventListener( 'focusout', function( event ) {
|
||||
hljs.highlightBlock( event.currentTarget );
|
||||
hljs.highlightElement( event.currentTarget );
|
||||
}, false );
|
||||
|
||||
if( config.highlightOnLoad ) {
|
||||
|
@ -85,7 +87,7 @@ const Plugin = {
|
|||
*/
|
||||
highlightBlock: function( block ) {
|
||||
|
||||
hljs.highlightBlock( block );
|
||||
hljs.highlightElement( block );
|
||||
|
||||
// Don't generate line numbers for empty code blocks
|
||||
if( block.innerHTML.trim().length === 0 ) return;
|
||||
|
|
Loading…
Reference in New Issue
Block a user