public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Trying to use code fragments (reveal.js) from markdown
@ 2020-09-29 11:22 Christian Braune
       [not found] ` <2b03582e-4cb0-452d-a138-571658329605n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Christian Braune @ 2020-09-29 11:22 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 1291 bytes --]

Hello,

I am trying to generate reveal.js slides from markdown that contain code.

Since v4.0.0 reveal.js supports fragmented (step by step highlighting) of 
code lines.
The syntax should be something like this:

~~~java [1-3|4-6]
...
~~~

The above example should generate something that shows the entire code, but 
on the first slide lines 1-3 are highlighted, on the seconf lines 4-6. [1]

When compiling the markdown to revealjs (specifying explicitly that I want 
to use revealjs@4.0) the result contains no code highlighting. In fact the 
code block is completely messed up. When removing the square brackets, 
everything is fine.
I am using pandoc v2.10.1 .

Is there a way to achieve this or is the reveal.js version not yet 
completely incorporated into pandoc?

Thanks and regards
  Christian

[1] https://github.com/hakimel/reveal.js/issues/2371#issuecomment-619835972

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/2b03582e-4cb0-452d-a138-571658329605n%40googlegroups.com.

[-- Attachment #1.2: Type: text/html, Size: 1787 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Trying to use code fragments (reveal.js) from markdown
       [not found] ` <2b03582e-4cb0-452d-a138-571658329605n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2020-09-29 18:19   ` John MacFarlane
       [not found]     ` <m2blhozbqr.fsf-jF64zX8BO08an7k8zZ43ob9bIa4KchGshsV+eolpW18@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: John MacFarlane @ 2020-09-29 18:19 UTC (permalink / raw)
  To: Christian Braune, pandoc-discuss


We do target v4.  However, pandoc uses its own syntax
highlighting, unless you disable this with `--no-highlight`.

I doubt this would be sufficient, though, to get this to
work.  Can you tell us what HTML (not markdown) reveal.js
expects to see for this syntax?

Christian Braune <christian.braune79-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> Hello,
>
> I am trying to generate reveal.js slides from markdown that contain code.
>
> Since v4.0.0 reveal.js supports fragmented (step by step highlighting) of 
> code lines.
> The syntax should be something like this:
>
> ~~~java [1-3|4-6]
> ...
> ~~~
>
> The above example should generate something that shows the entire code, but 
> on the first slide lines 1-3 are highlighted, on the seconf lines 4-6. [1]
>
> When compiling the markdown to revealjs (specifying explicitly that I want 
> to use revealjs@4.0) the result contains no code highlighting. In fact the 
> code block is completely messed up. When removing the square brackets, 
> everything is fine.
> I am using pandoc v2.10.1 .
>
> Is there a way to achieve this or is the reveal.js version not yet 
> completely incorporated into pandoc?
>
> Thanks and regards
>   Christian
>
> [1] https://github.com/hakimel/reveal.js/issues/2371#issuecomment-619835972
>
> -- 
> You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/2b03582e-4cb0-452d-a138-571658329605n%40googlegroups.com.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Trying to use code fragments (reveal.js) from markdown
       [not found]     ` <m2blhozbqr.fsf-jF64zX8BO08an7k8zZ43ob9bIa4KchGshsV+eolpW18@public.gmane.org>
@ 2020-09-30  7:01       ` Christian Braune
       [not found]         ` <CABfx9=eqNNRXZu_oNbG2gM1-XGG9QeOS03CXF89w0TwzzjfsWg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Christian Braune @ 2020-09-30  7:01 UTC (permalink / raw)
  To: John MacFarlane; +Cc: pandoc-discuss

[-- Attachment #1: Type: text/plain, Size: 3270 bytes --]

Hello John,

according to the reveal.js "docs" the HTML should look like this:

<pre><code data-line-numbers="|1-3|2|3-5|4|2,4">
if (a > b) {
    return c;
} else {
    return -1;
}
</code></pre>

reveal.js uses highlightjs to take care of the syntax highlighting itself,
I think.
The code snippet above should generate 6 slides, where at first the entire
code is highlighted, then only the first three lines, then only the second,
and so on (the last slide has lines 2 and 4 highlighted separately).

I was hoping to achieve this with the following markdown:

~~~java [|1-3|2|3-5|4|2,4]
  if (a > b) {
    return c;
} else {
    return -1;
}
~~~

There is a lua filter [1] out there, which would make this possible -
however it's not compatible with my template file and the rest of my
workflow. (which is kind of my own problem :/  )

Best regards
  Christian

[1] https://github.com/pandoc/lua-filters/tree/master/revealjs-codeblock


Am Di., 29. Sept. 2020 um 20:20 Uhr schrieb John MacFarlane <
jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org>:

>
> We do target v4.  However, pandoc uses its own syntax
> highlighting, unless you disable this with `--no-highlight`.
>
> I doubt this would be sufficient, though, to get this to
> work.  Can you tell us what HTML (not markdown) reveal.js
> expects to see for this syntax?
>
> Christian Braune <christian.braune79-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
>
> > Hello,
> >
> > I am trying to generate reveal.js slides from markdown that contain code.
> >
> > Since v4.0.0 reveal.js supports fragmented (step by step highlighting)
> of
> > code lines.
> > The syntax should be something like this:
> >
> > ~~~java [1-3|4-6]
> > ...
> > ~~~
> >
> > The above example should generate something that shows the entire code,
> but
> > on the first slide lines 1-3 are highlighted, on the seconf lines 4-6.
> [1]
> >
> > When compiling the markdown to revealjs (specifying explicitly that I
> want
> > to use revealjs@4.0) the result contains no code highlighting. In fact
> the
> > code block is completely messed up. When removing the square brackets,
> > everything is fine.
> > I am using pandoc v2.10.1 .
> >
> > Is there a way to achieve this or is the reveal.js version not yet
> > completely incorporated into pandoc?
> >
> > Thanks and regards
> >   Christian
> >
> > [1]
> https://github.com/hakimel/reveal.js/issues/2371#issuecomment-619835972
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "pandoc-discuss" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> > To view this discussion on the web visit
> https://groups.google.com/d/msgid/pandoc-discuss/2b03582e-4cb0-452d-a138-571658329605n%40googlegroups.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CABfx9%3DeqNNRXZu_oNbG2gM1-XGG9QeOS03CXF89w0TwzzjfsWg%40mail.gmail.com.

[-- Attachment #2: Type: text/html, Size: 4938 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Trying to use code fragments (reveal.js) from markdown
       [not found]         ` <CABfx9=eqNNRXZu_oNbG2gM1-XGG9QeOS03CXF89w0TwzzjfsWg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2020-09-30  8:56           ` BPJ
       [not found]             ` <CADAJKhCbW0JT_mcj59WJi4hWf0rnouv-qK_hHZw2dM9E_CeLkA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: BPJ @ 2020-09-30  8:56 UTC (permalink / raw)
  To: pandoc-discuss

[-- Attachment #1: Type: text/plain, Size: 4569 bytes --]

> I was hoping to achieve this with the following markdown:
>
> ~~~java [|1-3|2|3-5|4|2,4]

Have you tried this?

~~~{.java data-line-numbers="|1-3|2|3-5|4|2,4"}

If you think that is too much to type (as I would) a filter which "renames"
an attribute ln (or whatever you prefer) to data-line-numbers would be
trivial, assuming that Pandoc does place the data-* attribute on the code
element and not on the pre element.


-- 
Better --help|less than helpless

Den ons 30 sep. 2020 09:02Christian Braune <christian.braune79-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
skrev:

> Hello John,
>
> according to the reveal.js "docs" the HTML should look like this:
>
> <pre><code data-line-numbers="|1-3|2|3-5|4|2,4">
> if (a > b) {
>     return c;
> } else {
>     return -1;
> }
> </code></pre>
>
> reveal.js uses highlightjs to take care of the syntax highlighting itself,
> I think.
> The code snippet above should generate 6 slides, where at first the entire
> code is highlighted, then only the first three lines, then only the second,
> and so on (the last slide has lines 2 and 4 highlighted separately).
>
> I was hoping to achieve this with the following markdown:
>
> ~~~java [|1-3|2|3-5|4|2,4]
>   if (a > b) {
>     return c;
> } else {
>     return -1;
> }
> ~~~
>
> There is a lua filter [1] out there, which would make this possible -
> however it's not compatible with my template file and the rest of my
> workflow. (which is kind of my own problem :/  )
>
> Best regards
>   Christian
>
> [1] https://github.com/pandoc/lua-filters/tree/master/revealjs-codeblock
>
>
> Am Di., 29. Sept. 2020 um 20:20 Uhr schrieb John MacFarlane <
> jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org>:
>
>>
>> We do target v4.  However, pandoc uses its own syntax
>> highlighting, unless you disable this with `--no-highlight`.
>>
>> I doubt this would be sufficient, though, to get this to
>> work.  Can you tell us what HTML (not markdown) reveal.js
>> expects to see for this syntax?
>>
>> Christian Braune <christian.braune79-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
>>
>> > Hello,
>> >
>> > I am trying to generate reveal.js slides from markdown that contain
>> code.
>> >
>> > Since v4.0.0 reveal.js supports fragmented (step by step highlighting)
>> of
>> > code lines.
>> > The syntax should be something like this:
>> >
>> > ~~~java [1-3|4-6]
>> > ...
>> > ~~~
>> >
>> > The above example should generate something that shows the entire code,
>> but
>> > on the first slide lines 1-3 are highlighted, on the seconf lines 4-6.
>> [1]
>> >
>> > When compiling the markdown to revealjs (specifying explicitly that I
>> want
>> > to use revealjs@4.0) the result contains no code highlighting. In fact
>> the
>> > code block is completely messed up. When removing the square brackets,
>> > everything is fine.
>> > I am using pandoc v2.10.1 .
>> >
>> > Is there a way to achieve this or is the reveal.js version not yet
>> > completely incorporated into pandoc?
>> >
>> > Thanks and regards
>> >   Christian
>> >
>> > [1]
>> https://github.com/hakimel/reveal.js/issues/2371#issuecomment-619835972
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> Groups "pandoc-discuss" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>> > To view this discussion on the web visit
>> https://groups.google.com/d/msgid/pandoc-discuss/2b03582e-4cb0-452d-a138-571658329605n%40googlegroups.com
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pandoc-discuss/CABfx9%3DeqNNRXZu_oNbG2gM1-XGG9QeOS03CXF89w0TwzzjfsWg%40mail.gmail.com
> <https://groups.google.com/d/msgid/pandoc-discuss/CABfx9%3DeqNNRXZu_oNbG2gM1-XGG9QeOS03CXF89w0TwzzjfsWg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhCbW0JT_mcj59WJi4hWf0rnouv-qK_hHZw2dM9E_CeLkA%40mail.gmail.com.

[-- Attachment #2: Type: text/html, Size: 6975 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Trying to use code fragments (reveal.js) from markdown
       [not found]             ` <CADAJKhCbW0JT_mcj59WJi4hWf0rnouv-qK_hHZw2dM9E_CeLkA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2020-09-30 22:45               ` John MacFarlane
  0 siblings, 0 replies; 5+ messages in thread
From: John MacFarlane @ 2020-09-30 22:45 UTC (permalink / raw)
  To: BPJ, pandoc-discuss


> Have you tried this?
>
> ~~~{.java data-line-numbers="|1-3|2|3-5|4|2,4"}

This, plus --no-highlight, would ALMOST work -- but not quite,
because it will put the data-line-numbers attribute on the pre
element, not on the enclosed code element.

Relevant discussion here:
https://github.com/jgm/pandoc/issues/3858

maybe a bit of javascript could be applied to move the
attribute to the code element?


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-09-30 22:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-29 11:22 Trying to use code fragments (reveal.js) from markdown Christian Braune
     [not found] ` <2b03582e-4cb0-452d-a138-571658329605n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2020-09-29 18:19   ` John MacFarlane
     [not found]     ` <m2blhozbqr.fsf-jF64zX8BO08an7k8zZ43ob9bIa4KchGshsV+eolpW18@public.gmane.org>
2020-09-30  7:01       ` Christian Braune
     [not found]         ` <CABfx9=eqNNRXZu_oNbG2gM1-XGG9QeOS03CXF89w0TwzzjfsWg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2020-09-30  8:56           ` BPJ
     [not found]             ` <CADAJKhCbW0JT_mcj59WJi4hWf0rnouv-qK_hHZw2dM9E_CeLkA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2020-09-30 22:45               ` John MacFarlane

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).