No syntax highlighting with deck.js backend !

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

No syntax highlighting with deck.js backend !

wimalopaan
Hi all,

If I render the following simple file with html backend, the syntax-highlighting works well. But if I render it through the deck.js backend the syntax-highlighting gets completely lost!

So, what am I doing wrong here?

Rendered with:

$ asciidoctor -a data-uri -T ~/asciidoctor/asciidoctor-backends-master/haml -b deckjs test.adoc

---

= Test
wimalopaan <x@y.de>
:lang: de
:toc:
:numbered:
:src_numbered:
:icons: font
:sectanchors:
:sectlinks:
:experimental:
:source-highlighter: coderay
:coderay-css: class
:status:
:menu:
:navigation:
:split:
:goto:
:deckjs_theme: swiss

== Chap1

belongs to chap1

[source,cpp]
----
#include "bla"

int main()
{
}
----

bla

<<<

bla2

[source,java]
----
class {
      public static void main(String[] args) {
      }
}
----

== Chap2

belongs to chap2
Reply | Threaded
Open this post in threaded view
|

Re: No syntax highlighting with deck.js backend !

mojavelinux
Administrator
Wilhelm,

I assure you, you aren't doing anything wrong. This is a problem that needs to be resolved in Asciidoctor [1]. Fortunately, there's a simple workaround.

The problem is that Asciidoctor only performs syntax highlighting when the "base" backend attribute (i.e., basebackend attribute) is html. The basebackend attribute is determined by removing the trailing numbers from the backend name. For instance, html5 becomes html. However, deckjs becomes...deckjs. There in lies our problem.

The workaround is to set the backend to html5 (or just don't set it) and point the -T argument to the haml/deckjs folder inside the backends directory. The templates will be used in exactly the same way, except this time syntax highlighting will work!

In your case, the command you are looking for is:

 $ asciidoctor -a data-uri -T ~/asciidoctor/asciidoctor-backends-master/haml/deckjs test.adoc

Notice that I added "deckjs" to the path in the -T command flag and I removed the -b command flag. You should now see that syntax highlighting works.

Btw, if you want to have CodeRay embed the styles rather than link to a stylesheet, set the following attribute:

 :coderay-css: style

or

 -a coderay-css=style

I hope that gets everything working for you!

-Dan



On Sat, Feb 8, 2014 at 12:49 AM, wimalopaan [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Hi all,

If I render the following simple file with html backend, the syntax-highlighting works well. But if I render it through the deck.js backend the syntax-highlighting gets completely lost!

So, what am I doing wrong here?

Rendered with:

$ asciidoctor -a data-uri -T ~/asciidoctor/asciidoctor-backends-master/haml -b deckjs test.adoc

---

= Test
wimalopaan <[hidden email]>
:lang: de
:toc:
:numbered:
:src_numbered:
:icons: font
:sectanchors:
:sectlinks:
:experimental:
:source-highlighter: coderay
:coderay-css: class
:status:
:menu:
:navigation:
:split:
:goto:
:deckjs_theme: swiss

== Chap1

belongs to chap1

[source,cpp]
----
#include "bla"

int main()
{
}
----

bla

<<<

bla2

[source,java]
----
class {
      public static void main(String[] args) {
      }
}
----

== Chap2

belongs to chap2



If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/No-syntax-highlighting-with-deck-js-backend-tp1385.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Reply | Threaded
Open this post in threaded view
|

Re: No syntax highlighting with deck.js backend !

wimalopaan
Again: many thanks!

--
Wilhelm