From 58881061abf036bf8567d0c3351a2db776d8953e Mon Sep 17 00:00:00 2001 From: Gildasio Junior Date: Wed, 16 Aug 2023 15:34:57 -0300 Subject: [PATCH 01/10] Fix dracula's theme list-style on sub-items --- dist/theme/dracula.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/theme/dracula.css b/dist/theme/dracula.css index 3eb33069672..f17aac39fb3 100644 --- a/dist/theme/dracula.css +++ b/dist/theme/dracula.css @@ -382,7 +382,7 @@ section.has-light-background, section.has-light-background h1, section.has-light color: var(--r-inline-code-color); } -.reveal ul { +.reveal ul li { list-style: none; } @@ -411,4 +411,4 @@ section.has-light-background, section.has-light-background h1, section.has-light .reveal ol li { counter-increment: li; -} \ No newline at end of file +} From a3f71b4a9b7a464f1f44916e6b3155920b748630 Mon Sep 17 00:00:00 2001 From: Artur Neumann Date: Tue, 22 Aug 2023 13:56:46 +0545 Subject: [PATCH 02/10] fix typos in variable names --- plugin/markdown/plugin.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugin/markdown/plugin.js b/plugin/markdown/plugin.js index eb28f113eee..5132670463e 100755 --- a/plugin/markdown/plugin.js +++ b/plugin/markdown/plugin.js @@ -313,17 +313,17 @@ const Plugin = () => { */ function addAttributeInElement( node, elementTarget, separator ) { - var mardownClassesInElementsRegex = new RegExp( separator, 'mg' ); - var mardownClassRegex = new RegExp( "([^\"= ]+?)=\"([^\"]+?)\"|(data-[^\"= ]+?)(?=[\" ])", 'mg' ); + var markdownClassesInElementsRegex = new RegExp( separator, 'mg' ); + var markdownClassRegex = new RegExp( "([^\"= ]+?)=\"([^\"]+?)\"|(data-[^\"= ]+?)(?=[\" ])", 'mg' ); var nodeValue = node.nodeValue; var matches, matchesClass; - if( matches = mardownClassesInElementsRegex.exec( nodeValue ) ) { + if( matches = markdownClassesInElementsRegex.exec( nodeValue ) ) { var classes = matches[1]; - nodeValue = nodeValue.substring( 0, matches.index ) + nodeValue.substring( mardownClassesInElementsRegex.lastIndex ); + nodeValue = nodeValue.substring( 0, matches.index ) + nodeValue.substring( markdownClassesInElementsRegex.lastIndex ); node.nodeValue = nodeValue; - while( matchesClass = mardownClassRegex.exec( classes ) ) { + while( matchesClass = markdownClassRegex.exec( classes ) ) { if( matchesClass[2] ) { elementTarget.setAttribute( matchesClass[1], matchesClass[2] ); } else { From 9babaa005fee3480e97f6a2ca9d3ac750696fc62 Mon Sep 17 00:00:00 2001 From: Prarup Gurung Date: Tue, 22 Aug 2023 17:05:12 +0545 Subject: [PATCH 03/10] Refactored var to let or const, strict equality --- plugin/markdown/plugin.js | 74 +++++++++++++++++++-------------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/plugin/markdown/plugin.js b/plugin/markdown/plugin.js index 5132670463e..bb63de8f811 100755 --- a/plugin/markdown/plugin.js +++ b/plugin/markdown/plugin.js @@ -38,15 +38,15 @@ const Plugin = () => { function getMarkdownFromSlide( section ) { // look for a ' ); - var leadingWs = text.match( /^\n?(\s*)/ )[1].length, + const leadingWs = text.match( /^\n?(\s*)/ )[1].length, leadingTabs = text.match( /^\n?(\t*)/ )[1].length; if( leadingTabs > 0 ) { @@ -68,11 +68,11 @@ const Plugin = () => { */ function getForwardedAttributes( section ) { - var attributes = section.attributes; - var result = []; + const attributes = section.attributes; + const result = []; - for( var i = 0, len = attributes.length; i < len; i++ ) { - var name = attributes[i].name, + for( let i = 0, len = attributes.length; i < len; i++ ) { + const name = attributes[i].name, value = attributes[i].value; // disregard attributes that are used for markdown loading/parsing @@ -114,7 +114,7 @@ const Plugin = () => { options = getSlidifyOptions( options ); - var notesMatch = content.split( new RegExp( options.notesSeparator, 'mgi' ) ); + const notesMatch = content.split( new RegExp( options.notesSeparator, 'mgi' ) ); if( notesMatch.length === 2 ) { content = notesMatch[0] + ''; @@ -136,10 +136,10 @@ const Plugin = () => { options = getSlidifyOptions( options ); - var separatorRegex = new RegExp( options.separator + ( options.verticalSeparator ? '|' + options.verticalSeparator : '' ), 'mg' ), + const separatorRegex = new RegExp( options.separator + ( options.verticalSeparator ? '|' + options.verticalSeparator : '' ), 'mg' ), horizontalSeparatorRegex = new RegExp( options.separator ); - var matches, + let matches, lastIndex = 0, isHorizontal, wasHorizontal = true, @@ -148,7 +148,7 @@ const Plugin = () => { // iterate until all blocks between separators are stacked up while( matches = separatorRegex.exec( markdown ) ) { - var notes = null; + const notes = null; // determine direction (horizontal by default) isHorizontal = horizontalSeparatorRegex.test( matches[0] ); @@ -177,10 +177,10 @@ const Plugin = () => { // add the remaining slide ( wasHorizontal ? sectionStack : sectionStack[sectionStack.length-1] ).push( markdown.substring( lastIndex ) ); - var markdownSections = ''; + let markdownSections = ''; // flatten the hierarchical stack, and insert
tags - for( var i = 0, len = sectionStack.length; i < len; i++ ) { + for( let i = 0, len = sectionStack.length; i < len; i++ ) { // vertical if( sectionStack[i] instanceof Array ) { markdownSections += '
'; @@ -209,7 +209,7 @@ const Plugin = () => { return new Promise( function( resolve ) { - var externalPromises = []; + const externalPromises = []; [].slice.call( scope.querySelectorAll( 'section[data-markdown]:not([data-markdown-parsed])') ).forEach( function( section, i ) { @@ -262,13 +262,13 @@ const Plugin = () => { return new Promise( function( resolve, reject ) { - var xhr = new XMLHttpRequest(), + const xhr = new XMLHttpRequest(), url = section.getAttribute( 'data-markdown' ); - var datacharset = section.getAttribute( 'data-charset' ); + const datacharset = section.getAttribute( 'data-charset' ); // see https://developer.mozilla.org/en-US/docs/Web/API/element.getAttribute#Notes - if( datacharset != null && datacharset != '' ) { + if( datacharset !== null && datacharset !== '' ) { xhr.overrideMimeType( 'text/html; charset=' + datacharset ); } @@ -313,14 +313,14 @@ const Plugin = () => { */ function addAttributeInElement( node, elementTarget, separator ) { - var markdownClassesInElementsRegex = new RegExp( separator, 'mg' ); - var markdownClassRegex = new RegExp( "([^\"= ]+?)=\"([^\"]+?)\"|(data-[^\"= ]+?)(?=[\" ])", 'mg' ); - var nodeValue = node.nodeValue; - var matches, + const markdownClassesInElementsRegex = new RegExp( separator, 'mg' ); + const markdownClassRegex = new RegExp( "([^\"= ]+?)=\"([^\"]+?)\"|(data-[^\"= ]+?)(?=[\" ])", 'mg' ); + let nodeValue = node.nodeValue; + let matches, matchesClass; if( matches = markdownClassesInElementsRegex.exec( nodeValue ) ) { - var classes = matches[1]; + const classes = matches[1]; nodeValue = nodeValue.substring( 0, matches.index ) + nodeValue.substring( markdownClassesInElementsRegex.lastIndex ); node.nodeValue = nodeValue; while( matchesClass = markdownClassRegex.exec( classes ) ) { @@ -341,34 +341,34 @@ const Plugin = () => { */ function addAttributes( section, element, previousElement, separatorElementAttributes, separatorSectionAttributes ) { - if ( element != null && element.childNodes != undefined && element.childNodes.length > 0 ) { - var previousParentElement = element; - for( var i = 0; i < element.childNodes.length; i++ ) { - var childElement = element.childNodes[i]; + if ( element !== null && element.childNodes !== undefined && element.childNodes.length > 0 ) { + let previousParentElement = element; + for( let i = 0; i < element.childNodes.length; i++ ) { + const childElement = element.childNodes[i]; if ( i > 0 ) { - var j = i - 1; + let j = i - 1; while ( j >= 0 ) { - var aPreviousChildElement = element.childNodes[j]; - if ( typeof aPreviousChildElement.setAttribute == 'function' && aPreviousChildElement.tagName != "BR" ) { + const aPreviousChildElement = element.childNodes[j]; + if ( typeof aPreviousChildElement.setAttribute === 'function' && aPreviousChildElement.tagName !== "BR" ) { previousParentElement = aPreviousChildElement; break; } j = j - 1; } } - var parentSection = section; - if( childElement.nodeName == "section" ) { + let parentSection = section; + if( childElement.nodeName === "section" ) { parentSection = childElement ; previousParentElement = childElement ; } - if ( typeof childElement.setAttribute == 'function' || childElement.nodeType == Node.COMMENT_NODE ) { + if ( typeof childElement.setAttribute === 'function' || childElement.nodeType === Node.COMMENT_NODE ) { addAttributes( parentSection, childElement, previousParentElement, separatorElementAttributes, separatorSectionAttributes ); } } } - if ( element.nodeType == Node.COMMENT_NODE ) { - if ( addAttributeInElement( element, previousElement, separatorElementAttributes ) == false ) { + if ( element.nodeType === Node.COMMENT_NODE ) { + if ( addAttributeInElement( element, previousElement, separatorElementAttributes ) === false ) { addAttributeInElement( element, section, separatorSectionAttributes ); } } @@ -380,14 +380,14 @@ const Plugin = () => { */ function convertSlides() { - var sections = deck.getRevealElement().querySelectorAll( '[data-markdown]:not([data-markdown-parsed])'); + const sections = deck.getRevealElement().querySelectorAll( '[data-markdown]:not([data-markdown-parsed])'); [].slice.call( sections ).forEach( function( section ) { section.setAttribute( 'data-markdown-parsed', true ) - var notes = section.querySelector( 'aside.notes' ); - var markdown = getMarkdownFromSlide( section ); + const notes = section.querySelector( 'aside.notes' ); + const markdown = getMarkdownFromSlide( section ); section.innerHTML = marked( markdown ); addAttributes( section, section, null, section.getAttribute( 'data-element-attributes' ) || From ccbaffc975a36f54bbcbc21211c49f2bba82751b Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Wed, 23 Aug 2023 10:21:57 +0200 Subject: [PATCH 04/10] build md plugin #3454 --- plugin/markdown/markdown.esm.js | 2 +- plugin/markdown/markdown.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin/markdown/markdown.esm.js b/plugin/markdown/markdown.esm.js index f10b117765c..54cac1497fa 100644 --- a/plugin/markdown/markdown.esm.js +++ b/plugin/markdown/markdown.esm.js @@ -4,4 +4,4 @@ function e(){return{baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,h * markdown inside of presentations as well as loading * of external markdown documents. */ -const D="__SCRIPT_END__",P=/\[\s*((\d*):)?\s*([\s\d,|-]*)\]/,M={"&":"&","<":"<",">":">",'"':""","'":"'"};export default()=>{let e;function t(e){var t=(e.querySelector("[data-template]")||e.querySelector("script")||e).textContent,n=(t=t.replace(new RegExp(D,"g"),"<\/script>")).match(/^\n?(\s*)/)[1].length,r=t.match(/^\n?(\t*)/)[1].length;return r>0?t=t.replace(new RegExp("\\n?\\t{"+r+"}(.*)","g"),(function(e,t){return"\n"+t})):n>1&&(t=t.replace(new RegExp("\\n? {"+n+"}(.*)","g"),(function(e,t){return"\n"+t}))),t}function n(e){for(var t=e.attributes,n=[],r=0,s=t.length;r'+N(n[1].trim())+""),'