From 80aadaf74e901b184d86b536c0c01e0fe98623d0 Mon Sep 17 00:00:00 2001 From: Gabriel Pillet Date: Thu, 31 Oct 2013 14:02:34 +0100 Subject: Removing global flag for replacing whitespaces --- plugin/markdown/markdown.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugin/markdown') diff --git a/plugin/markdown/markdown.js b/plugin/markdown/markdown.js index d6c6c45..23a3ed4 100755 --- a/plugin/markdown/markdown.js +++ b/plugin/markdown/markdown.js @@ -49,7 +49,7 @@ text = text.replace( new RegExp('\\n?\\t{' + leadingTabs + '}','g'), '\n' ); } else if( leadingWs > 1 ) { - text = text.replace( new RegExp('\\n? {' + leadingWs + '}','g'), '\n' ); + text = text.replace( new RegExp('\\n? {' + leadingWs + '}'), '\n' ); } return text; -- cgit v1.2.3 From 015468c3a2d1d4092f33920ac555a0e288e6213f Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Mon, 17 Feb 2014 21:15:02 +0100 Subject: renamed markdown attributes for clarity and consistency: data-vertical -> data-separator-vertical, data-notes -> data-separator-notes --- README.md | 6 +++--- plugin/markdown/example.html | 4 ++-- plugin/markdown/markdown.js | 10 +++++----- test/test-markdown-element-attributes.html | 8 ++++---- test/test-markdown-slide-attributes.html | 10 +++++----- test/test-markdown.html | 4 ++-- 6 files changed, 21 insertions(+), 21 deletions(-) (limited to 'plugin/markdown') diff --git a/README.md b/README.md index 8a37a0d..cbdb088 100644 --- a/README.md +++ b/README.md @@ -59,8 +59,8 @@ When used locally, this feature requires that reveal.js [runs from a local web s ```html
``` @@ -621,7 +621,7 @@ When used locally, this feature requires that reveal.js [runs from a local web s If you're using the external Markdown plugin, you can add notes with the help of a special delimiter: ```html -
+
# Title ## Sub-title diff --git a/plugin/markdown/example.html b/plugin/markdown/example.html index 909639f..364e866 100644 --- a/plugin/markdown/example.html +++ b/plugin/markdown/example.html @@ -19,7 +19,7 @@
-
+
@@ -36,7 +36,7 @@
-
+
end bug inside code markdown by changing the tag before html is parsed and restoring it before markdown parsing--- plugin/markdown/markdown.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'plugin/markdown') diff --git a/plugin/markdown/markdown.js b/plugin/markdown/markdown.js index 9afee06..738195f 100755 --- a/plugin/markdown/markdown.js +++ b/plugin/markdown/markdown.js @@ -42,7 +42,8 @@ // strip leading whitespace so it isn't evaluated as code var text = ( template || section ).textContent; - + // restore script end tag + text = text.replace(/__SCRIPT_END__/g, ''); var leadingWs = text.match( /^\n?(\s*)/ )[1].length, leadingTabs = text.match( /^\n?(\t*)/ )[1].length; @@ -114,7 +115,8 @@ if( notesMatch.length === 2 ) { content = notesMatch[0] + ''; } - + //handle script end tag bug + content = content.replace(/<\/script>/g, '__SCRIPT_END__'); return ''; } -- cgit v1.2.3 From d44125d789a8d80beaf6426379c23270bee131d9 Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Tue, 7 Jul 2015 12:15:43 +0200 Subject: tweaks for #1200 --- plugin/markdown/markdown.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'plugin/markdown') diff --git a/plugin/markdown/markdown.js b/plugin/markdown/markdown.js index 14433e6..f4035e2 100755 --- a/plugin/markdown/markdown.js +++ b/plugin/markdown/markdown.js @@ -31,6 +31,8 @@ DEFAULT_ELEMENT_ATTRIBUTES_SEPARATOR = '\\\.element\\\s*?(.+?)$', DEFAULT_SLIDE_ATTRIBUTES_SEPARATOR = '\\\.slide:\\\s*?(\\\S.+?)$'; + var SCRIPT_END_PLACEHOLDER = '__SCRIPT_END__'; + /** * Retrieves the markdown contents of a slide section @@ -42,8 +44,10 @@ // strip leading whitespace so it isn't evaluated as code var text = ( template || section ).textContent; - // restore script end tag - text = text.replace(/__SCRIPT_END__/g, ''); + + // restore script end tags + text = text.replace( new RegExp( SCRIPT_END_PLACEHOLDER, 'g' ), '' ); + var leadingWs = text.match( /^\n?(\s*)/ )[1].length, leadingTabs = text.match( /^\n?(\t*)/ )[1].length; @@ -115,8 +119,11 @@ if( notesMatch.length === 2 ) { content = notesMatch[0] + ''; } - //handle script end tag bug - content = content.replace(/<\/script>/g, '__SCRIPT_END__'); + + // prevent script end tags in the content from interfering + // with parsing + content = content.replace( /<\/script>/g, SCRIPT_END_PLACEHOLDER ); + return ''; } -- cgit v1.2.3