From b8d8aa51e1d399ea06220252ef5a1c16451def77 Mon Sep 17 00:00:00 2001 From: Dietrich Schulten Date: Tue, 26 Dec 2017 10:35:35 +0100 Subject: [PATCH 1/5] Explained that source-highlighter must be defined --- README.adoc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/README.adoc b/README.adoc index ddca4c32..8a73794c 100644 --- a/README.adoc +++ b/README.adoc @@ -383,6 +383,16 @@ To override that behavior use the `width` and `height` named attributes. === Syntax highlighting +To enable https://highlightjs.org/[highlight.js] for syntax highlighting (which is the `revealjs` default): + +[source, asciidoc] +---- += Title slide +:source-highlighter: highlightjs +---- + +With enabled source-highlighter you can write code blocks as usual: + [source, asciidoc] .... == Slide Five @@ -395,7 +405,6 @@ print "Hello World" ---- .... -`revealjs` uses https://highlightjs.org/[highlight.js] to do its syntax highlighting by default. By default `[source]` blocks and blocks delimited by `----` will be highlighted. An explicit `[listing]` block will not be highlighted. `highlight.js` does language auto-detection but using the `language="..."` attribute will hint the highlighter. From 9fa402afd689634c9002032dc026533881b68c76 Mon Sep 17 00:00:00 2001 From: Dietrich Schulten Date: Tue, 26 Dec 2017 11:51:03 +0100 Subject: [PATCH 2/5] Add data-noescape to highlightjs callouts --- templates/inline_callout.html.slim | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/templates/inline_callout.html.slim b/templates/inline_callout.html.slim index 452c19d8..4a722e58 100644 --- a/templates/inline_callout.html.slim +++ b/templates/inline_callout.html.slim @@ -1,7 +1,16 @@ -- if @document.attr? :icons, 'font' - i.conum data-value=@text - b="(#{@text})" -- elsif @document.attr? :icons - img src=icon_uri("callouts/#{@text}") alt=@text -- else - b="(#{@text})" +- if @document.attr? :source-highlighter, 'highlightjs' + - if @document.attr? :icons, 'font' + i.conum[data-noescape data-value=@text] + b[data-noescape] "(#{@text})" + - elsif @document.attr? :icons + img[data-noescape src=icon_uri("callouts/#{@text}") alt=@text] + - else + b[data-noescape] "(#{@text})" +- else + - if @document.attr? :icons, 'font' + i.conum data-value=@text + b="(#{@text})" + - elsif @document.attr? :icons + img src=icon_uri("callouts/#{@text}") alt=@text + - else + b="(#{@text})" From 63206cddc1f1efe5c59a9e4cc3e1b52c683dd03e Mon Sep 17 00:00:00 2001 From: dschulten Date: Tue, 26 Dec 2017 13:03:07 +0100 Subject: [PATCH 3/5] fix was needed in listing.html.slim, not inline_callout.html.slim --- templates/inline_callout.html.slim | 23 +++++++---------------- templates/listing.html.slim | 6 ++++-- 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/templates/inline_callout.html.slim b/templates/inline_callout.html.slim index 4a722e58..452c19d8 100644 --- a/templates/inline_callout.html.slim +++ b/templates/inline_callout.html.slim @@ -1,16 +1,7 @@ -- if @document.attr? :source-highlighter, 'highlightjs' - - if @document.attr? :icons, 'font' - i.conum[data-noescape data-value=@text] - b[data-noescape] "(#{@text})" - - elsif @document.attr? :icons - img[data-noescape src=icon_uri("callouts/#{@text}") alt=@text] - - else - b[data-noescape] "(#{@text})" -- else - - if @document.attr? :icons, 'font' - i.conum data-value=@text - b="(#{@text})" - - elsif @document.attr? :icons - img src=icon_uri("callouts/#{@text}") alt=@text - - else - b="(#{@text})" +- if @document.attr? :icons, 'font' + i.conum data-value=@text + b="(#{@text})" +- elsif @document.attr? :icons + img src=icon_uri("callouts/#{@text}") alt=@text +- else + b="(#{@text})" diff --git a/templates/listing.html.slim b/templates/listing.html.slim index fbb87b88..3870783d 100644 --- a/templates/listing.html.slim +++ b/templates/listing.html.slim @@ -10,6 +10,7 @@ - code_class = language ? [language, "language-#{language}"] : nil - pre_class = ['highlight'] - pre_lang = nil + - code_noescape = false - case attr 'source-highlighter' - when 'coderay' - pre_class = ['CodeRay'] @@ -25,9 +26,10 @@ - pre_lang = language - pre_class = code_class = nil - nowrap = false - /- when 'highlightjs', 'highlight.js' + - when 'highlightjs', 'highlight.js' + - code_noescape=true - pre_class << 'nowrap' if nowrap pre class=pre_class lang=pre_lang - code class=code_class =content + code data-noescape=code_noescape class=code_class =content - else pre class=(nowrap ? 'nowrap' : nil) =content From 67884d157ca21b7e5231c45ddc1b9cb614a035ec Mon Sep 17 00:00:00 2001 From: Olivier Bilodeau Date: Tue, 26 Dec 2017 14:29:59 -0500 Subject: [PATCH 4/5] Updated CHANGELOG --- CHANGELOG.adoc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 16fd0015..4f0d6e3a 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -6,6 +6,19 @@ This document provides a high-level view of the changes introduced in {project-name} by release. For a detailed view of what has changed, refer to the {uri-repo}/commits/master[commit history] on GitHub. +== Master branch + +Enhancements:: + * Documentation improvements ({uri-issue}165[#165]) + +//// +=== Release meta + +{uri-repo}/releases/tag/v1.1.0[git tag] | +{uri-repo}/compare/v1.0.4...v1.1.0[full diff] +//// + + == 1.1.0 (2017-12-25) - @obilodeau Enhancements:: From a2160cf48e22bf6e3914d3d83c47a69bd00d2d9d Mon Sep 17 00:00:00 2001 From: Olivier Bilodeau Date: Tue, 26 Dec 2017 15:01:27 -0500 Subject: [PATCH 5/5] Fixed tests and example AsciiDoc --- examples/source-callouts.adoc | 3 +-- test/doctest/source-callouts.html | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/examples/source-callouts.adoc b/examples/source-callouts.adoc index 93bf4f67..ad86e547 100644 --- a/examples/source-callouts.adoc +++ b/examples/source-callouts.adoc @@ -10,11 +10,10 @@ Me == Callout -// FIXME source callouts are broken right now [source, rust] ---- fn main() { println!("Hello World!"); // <1> - } +} ---- <1> `println!` is a macro. diff --git a/test/doctest/source-callouts.html b/test/doctest/source-callouts.html index e4880c97..313a59ee 100644 --- a/test/doctest/source-callouts.html +++ b/test/doctest/source-callouts.html @@ -8,9 +8,9 @@

Presentation

Callout

-
fn main() {
+        
fn main() {
     println!("Hello World!"); (1)
-    }
+}