public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* How to manipuate <code> block instead of <pre>
@ 2020-09-11 21:05 J. E. Marca
       [not found] ` <cac0e082-2af2-420b-ad6d-aef9afc1c2f9n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: J. E. Marca @ 2020-09-11 21:05 UTC (permalink / raw)
  To: pandoc-discuss


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

Hi all,

(Apologies in advance if the online editor mangles this post, as I'm 
writing lots html pre tags)

I use pandoc to generate reveal.js presentations. All works well if I let 
pandoc do its thing. 


However, was looking through the reveal.js v4 docs, and there is a really 
useful hack to highlight successive lines of a code block. See 
https://revealjs.com/code/#step-by-step-highlights.

To use it, the reveal.js docs say to add "data-line-numbers" inside of the 
<code> tag. For example:

```
<pre><code data-line-numbers="3-5|8-10|13-15">
...

```


That is difficult in pandoc at the moment, as access to the <code> block 
attributes is prevented (see also pandoc issue 
[#3858](https://github.com/jgm/pandoc/issues/3858))


Using this:

```{.bash data-line-numbers="1,2,3,4|4|2|3"}
osmium extract \
-p port-au-prince-poly.osm \
-o port-au-prince-latest.osm \
haiti-and-domrep-latest.osm.pbf
```

produces:

<pre class="bash" data-line-numbers="1,2,3,4|4|2|3" ><code ...


I want the data-line-numbers and in fact the class=bash (or 
class=language-bash" ) to be on the code block.


The issue I referenced above (#3858) was opened in August 2017 so I'm not 
hopeful for any movement from pandoc. But, it would be useful if there was 
yet another command line switch to force all code markup to occur on the 
<code> block, OR the <pre> block, OR both. Esp. given that the HTML 
recommendation still suggests putting language-*** class inside the <code> 
block.


Any other ways around this? My current solution is just to straight up use 
<pre><code  foo=bar etc=etc> tags inside my markdown, which I hate doing as 
it means I'm only targeting reveal.js.


Thanks,
James Marca

-- 
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/cac0e082-2af2-420b-ad6d-aef9afc1c2f9n%40googlegroups.com.

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

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

* Re: How to manipuate <code> block instead of <pre>
       [not found] ` <cac0e082-2af2-420b-ad6d-aef9afc1c2f9n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2020-09-12  8:16   ` Albert Krewinkel
       [not found]     ` <87een7l89k.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Albert Krewinkel @ 2020-09-12  8:16 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

Please checkout
<https://github.com/pandoc/lua-filters/tree/master/revealjs-codeblock>,
it should help with your issue.

J. E. Marca writes:

> Hi all,
>
> (Apologies in advance if the online editor mangles this post, as I'm
> writing lots html pre tags)
>
> I use pandoc to generate reveal.js presentations. All works well if I let
> pandoc do its thing.
>
>
> However, was looking through the reveal.js v4 docs, and there is a really
> useful hack to highlight successive lines of a code block. See
> https://revealjs.com/code/#step-by-step-highlights.
>
> To use it, the reveal.js docs say to add "data-line-numbers" inside of the
> <code> tag. For example:
>
> ```
> <pre><code data-line-numbers="3-5|8-10|13-15">
> ...
>
> ```
>
>
> That is difficult in pandoc at the moment, as access to the <code> block
> attributes is prevented (see also pandoc issue
> [#3858](https://github.com/jgm/pandoc/issues/3858))
>
>
> Using this:
>
> ```{.bash data-line-numbers="1,2,3,4|4|2|3"}
> osmium extract \
> -p port-au-prince-poly.osm \
> -o port-au-prince-latest.osm \
> haiti-and-domrep-latest.osm.pbf
> ```
>
> produces:
>
> <pre class="bash" data-line-numbers="1,2,3,4|4|2|3" ><code ...
>
>
> I want the data-line-numbers and in fact the class=bash (or
> class=language-bash" ) to be on the code block.
>
>
> The issue I referenced above (#3858) was opened in August 2017 so I'm not
> hopeful for any movement from pandoc. But, it would be useful if there was
> yet another command line switch to force all code markup to occur on the
> <code> block, OR the <pre> block, OR both. Esp. given that the HTML
> recommendation still suggests putting language-*** class inside the <code>
> block.
>
>
> Any other ways around this? My current solution is just to straight up use
> <pre><code  foo=bar etc=etc> tags inside my markdown, which I hate doing as
> it means I'm only targeting reveal.js.
>
>
> Thanks,
> James Marca


--
Albert Krewinkel
GPG: 8eed e3e2 e8c5 6f18 81fe  e836 388d c0b2 1f63 1124


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

* Re: How to manipuate <code> block instead of <pre>
       [not found]     ` <87een7l89k.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
@ 2020-09-12 18:50       ` blind.line
  2020-09-12 20:22       ` blind.line
  1 sibling, 0 replies; 4+ messages in thread
From: blind.line @ 2020-09-12 18:50 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

Sweet that looks perfect. 

Thanks,

James

> On Sep 12, 2020, at 01:35, Albert Krewinkel <albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org> wrote:
> 
> Please checkout
> <https://github.com/pandoc/lua-filters/tree/master/revealjs-codeblock>,
> it should help with your issue.
> 
> J. E. Marca writes:
> 
>> Hi all,
>> 
>> (Apologies in advance if the online editor mangles this post, as I'm
>> writing lots html pre tags)
>> 
>> I use pandoc to generate reveal.js presentations. All works well if I let
>> pandoc do its thing.
>> 
>> 
>> However, was looking through the reveal.js v4 docs, and there is a really
>> useful hack to highlight successive lines of a code block. See
>> https://revealjs.com/code/#step-by-step-highlights.
>> 
>> To use it, the reveal.js docs say to add "data-line-numbers" inside of the
>> <code> tag. For example:
>> 
>> ```
>> <pre><code data-line-numbers="3-5|8-10|13-15">
>> ...
>> 
>> ```
>> 
>> 
>> That is difficult in pandoc at the moment, as access to the <code> block
>> attributes is prevented (see also pandoc issue
>> [#3858](https://github.com/jgm/pandoc/issues/3858))
>> 
>> 
>> Using this:
>> 
>> ```{.bash data-line-numbers="1,2,3,4|4|2|3"}
>> osmium extract \
>> -p port-au-prince-poly.osm \
>> -o port-au-prince-latest.osm \
>> haiti-and-domrep-latest.osm.pbf
>> ```
>> 
>> produces:
>> 
>> <pre class="bash" data-line-numbers="1,2,3,4|4|2|3" ><code ...
>> 
>> 
>> I want the data-line-numbers and in fact the class=bash (or
>> class=language-bash" ) to be on the code block.
>> 
>> 
>> The issue I referenced above (#3858) was opened in August 2017 so I'm not
>> hopeful for any movement from pandoc. But, it would be useful if there was
>> yet another command line switch to force all code markup to occur on the
>> <code> block, OR the <pre> block, OR both. Esp. given that the HTML
>> recommendation still suggests putting language-*** class inside the <code>
>> block.
>> 
>> 
>> Any other ways around this? My current solution is just to straight up use
>> <pre><code  foo=bar etc=etc> tags inside my markdown, which I hate doing as
>> it means I'm only targeting reveal.js.
>> 
>> 
>> Thanks,
>> James Marca
> 
> 
> --
> Albert Krewinkel
> GPG: 8eed e3e2 e8c5 6f18 81fe  e836 388d c0b2 1f63 1124
> 
> -- 
> You received this message because you are subscribed to a topic in the Google Groups "pandoc-discuss" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/pandoc-discuss/DlJW1NE48W0/unsubscribe.
> To unsubscribe from this group and all its topics, 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/87een7l89k.fsf%40zeitkraut.de.

-- 
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/E0A96D8F-922D-4866-9023-891BF0B16F10%40gmail.com.


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

* Re: How to manipuate <code> block instead of <pre>
       [not found]     ` <87een7l89k.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
  2020-09-12 18:50       ` blind.line
@ 2020-09-12 20:22       ` blind.line
  1 sibling, 0 replies; 4+ messages in thread
From: blind.line @ 2020-09-12 20:22 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

Yep it works perfectly. Thanks again for the pointer

James

> On Sep 12, 2020, at 01:35, Albert Krewinkel <albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org> wrote:
> 
> Please checkout
> <https://github.com/pandoc/lua-filters/tree/master/revealjs-codeblock>,
> it should help with your issue.
> 
> J. E. Marca writes:
> 
>> Hi all,
>> 
>> (Apologies in advance if the online editor mangles this post, as I'm
>> writing lots html pre tags)
>> 
>> I use pandoc to generate reveal.js presentations. All works well if I let
>> pandoc do its thing.
>> 
>> 
>> However, was looking through the reveal.js v4 docs, and there is a really
>> useful hack to highlight successive lines of a code block. See
>> https://revealjs.com/code/#step-by-step-highlights.
>> 
>> To use it, the reveal.js docs say to add "data-line-numbers" inside of the
>> <code> tag. For example:
>> 
>> ```
>> <pre><code data-line-numbers="3-5|8-10|13-15">
>> ...
>> 
>> ```
>> 
>> 
>> That is difficult in pandoc at the moment, as access to the <code> block
>> attributes is prevented (see also pandoc issue
>> [#3858](https://github.com/jgm/pandoc/issues/3858))
>> 
>> 
>> Using this:
>> 
>> ```{.bash data-line-numbers="1,2,3,4|4|2|3"}
>> osmium extract \
>> -p port-au-prince-poly.osm \
>> -o port-au-prince-latest.osm \
>> haiti-and-domrep-latest.osm.pbf
>> ```
>> 
>> produces:
>> 
>> <pre class="bash" data-line-numbers="1,2,3,4|4|2|3" ><code ...
>> 
>> 
>> I want the data-line-numbers and in fact the class=bash (or
>> class=language-bash" ) to be on the code block.
>> 
>> 
>> The issue I referenced above (#3858) was opened in August 2017 so I'm not
>> hopeful for any movement from pandoc. But, it would be useful if there was
>> yet another command line switch to force all code markup to occur on the
>> <code> block, OR the <pre> block, OR both. Esp. given that the HTML
>> recommendation still suggests putting language-*** class inside the <code>
>> block.
>> 
>> 
>> Any other ways around this? My current solution is just to straight up use
>> <pre><code  foo=bar etc=etc> tags inside my markdown, which I hate doing as
>> it means I'm only targeting reveal.js.
>> 
>> 
>> Thanks,
>> James Marca
> 
> 
> --
> Albert Krewinkel
> GPG: 8eed e3e2 e8c5 6f18 81fe  e836 388d c0b2 1f63 1124
> 
> -- 
> You received this message because you are subscribed to a topic in the Google Groups "pandoc-discuss" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/pandoc-discuss/DlJW1NE48W0/unsubscribe.
> To unsubscribe from this group and all its topics, 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/87een7l89k.fsf%40zeitkraut.de.

-- 
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/F647724D-26A3-4A1E-912D-B8C1BBE66315%40gmail.com.


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

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

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-11 21:05 How to manipuate <code> block instead of <pre> J. E. Marca
     [not found] ` <cac0e082-2af2-420b-ad6d-aef9afc1c2f9n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2020-09-12  8:16   ` Albert Krewinkel
     [not found]     ` <87een7l89k.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
2020-09-12 18:50       ` blind.line
2020-09-12 20:22       ` blind.line

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).