public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Two spaces before a fenced code block
@ 2017-11-08 22:51 Yihui Xie
       [not found] ` <573489f2-ba60-4239-9c21-3159bd78ff8b-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Yihui Xie @ 2017-11-08 22:51 UTC (permalink / raw)
  To: pandoc-discuss


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

Hi,

After I upgraded from Pandoc 1.19 to 2.0, I was surprised that my fenced 
code blocks under list items no longer worked:

- Item One.

- Item Two.

    ```
    Code
    ```

I was expecting it to be translated to

<ul>
<li><p>Item One.</p></li>
<li><p>Item Two.</p>
<pre><code>Code</code></pre></li>
</ul>

but it wasn't (there was no <pre></pre>). I read the release notes, and it 
took me quite a while to realize that I had to indent by two spaces in this 
case to line up with the list content:

- Item One.

- Item Two.

  ```
  Code
  ```

The reason that the previous Markdown example was not recognized as a 
fenced code block under a list item was that the four spaces = two spaces 
(to line up with list) + two spaces, and the latter two spaces turned the 
"fenced code block" into a paragraph:

  ```
  Code
  ```

<p><code>Code</code></p>

Then I checked with Pandoc 1.19 again and realized it was also the case 
there. Everything is clear to me now, but it is still surprising to me that 
the two spaces before a fenced code block are actually meaningful.

BTW, I'm aware of the four_space_rule extension (which is disabled by 
default).

Yihui

-- 
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 post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/573489f2-ba60-4239-9c21-3159bd78ff8b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

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

* Re: Two spaces before a fenced code block
       [not found] ` <573489f2-ba60-4239-9c21-3159bd78ff8b-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2017-11-09  1:36   ` John MACFARLANE
  2017-11-09 15:18   ` John Gabriele
  1 sibling, 0 replies; 3+ messages in thread
From: John MACFARLANE @ 2017-11-09  1:36 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

See https://github.com/jgm/pandoc/issues/4051
We might want to relax the behavior here, more along
the lines of CommonMark.

+++ Yihui Xie [Nov 08 17 14:51 ]:
>   Hi,
>   After I upgraded from Pandoc 1.19 to 2.0, I was surprised that my
>   fenced code blocks under list items no longer worked:
>   - Item One.
>   - Item Two.
>       ```
>       Code
>       ```
>   I was expecting it to be translated to
>   <ul>
>   <li><p>Item One.</p></li>
>   <li><p>Item Two.</p>
>   <pre><code>Code</code></pre></li>
>   </ul>
>   but it wasn't (there was no <pre></pre>). I read the release notes, and
>   it took me quite a while to realize that I had to indent by two spaces
>   in this case to line up with the list content:
>   - Item One.
>   - Item Two.
>     ```
>     Code
>     ```
>   The reason that the previous Markdown example was not recognized as a
>   fenced code block under a list item was that the four spaces = two
>   spaces (to line up with list) + two spaces, and the latter two spaces
>   turned the "fenced code block" into a paragraph:
>     ```
>     Code
>     ```
>   <p><code>Code</code></p>
>   Then I checked with Pandoc 1.19 again and realized it was also the case
>   there. Everything is clear to me now, but it is still surprising to me
>   that the two spaces before a fenced code block are actually meaningful.
>   BTW, I'm aware of the four_space_rule extension (which is disabled by
>   default).
>   Yihui
>
>   --
>   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 [1]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>   To post to this group, send email to
>   [2]pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>   To view this discussion on the web visit
>   [3]https://groups.google.com/d/msgid/pandoc-discuss/573489f2-ba60-4239-
>   9c21-3159bd78ff8b%40googlegroups.com.
>   For more options, visit [4]https://groups.google.com/d/optout.
>
>References
>
>   1. mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
>   2. mailto:pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
>   3. https://groups.google.com/d/msgid/pandoc-discuss/573489f2-ba60-4239-9c21-3159bd78ff8b-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org?utm_medium=email&utm_source=footer
>   4. https://groups.google.com/d/optout


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

* Re: Two spaces before a fenced code block
       [not found] ` <573489f2-ba60-4239-9c21-3159bd78ff8b-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  2017-11-09  1:36   ` John MACFARLANE
@ 2017-11-09 15:18   ` John Gabriele
  1 sibling, 0 replies; 3+ messages in thread
From: John Gabriele @ 2017-11-09 15:18 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

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

On Wed, Nov 8, 2017, at 05:51 PM, Yihui Xie wrote:
> Hi,
> 
> After I upgraded from Pandoc 1.19 to 2.0, I was surprised that my
> fenced code blocks under list items no longer worked:> {snip}[1]

Chucking in my 2 cents here, I've found that it's most consistent to
always have *content* be aligned at 4-space increments. That is:
~~~
Para 1

  * list item 1 (note, content starts at 4 spaces in)

  * list item 2

    ~~~
    code block here
    in list item 2
    ~~~
   
    Another para in list item 2.

        another code block
        in list item 2

    Another para in list item 2.

      * list item 2.1 (content starts at 8 spaces in)
      * list item 2.2

  * list item 3

Para 2
~~~

Likewise with other elements like definition lists.

Incidentally, note also that all the following  list styles work (and
content in all of them starts at 4 spaces in):
~~~
Para 1

*   foo
*   bar
*   baz

Para 2

*  foo
*  bar
*  baz

Para 3

  * foo
  * bar
  * baz

Para 4
~~~

-- John


Links:

  1. https://groups.google.com/d/optout

-- 
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 post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/1510240710.2073843.1167054816.575294AB%40webmail.messagingengine.com.
For more options, visit https://groups.google.com/d/optout.

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

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

end of thread, other threads:[~2017-11-09 15:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-08 22:51 Two spaces before a fenced code block Yihui Xie
     [not found] ` <573489f2-ba60-4239-9c21-3159bd78ff8b-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2017-11-09  1:36   ` John MACFARLANE
2017-11-09 15:18   ` John Gabriele

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