public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Fenced code blocks in multiline tables
@ 2015-07-20 13:17 Ivan Lazar Miljenovic
       [not found] ` <CA+u6gbzerR6py_HuF1fw273NMPzT+sqH3pvw38vP=2p9sv7jrA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Ivan Lazar Miljenovic @ 2015-07-20 13:17 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

I'm trying to have a slide in my presentation where I compare two code samples.

I thought the best way of doing so would be to use a multiline table,
with a code block on either side.

The problem is that whilst the code block is accepted within the
multiline table, it doesn't seem to parse properly.

A sample table:

--------------------------------------------------------------------------------
     Regular Express                              Parser Combinators
---------------------------------  ---------------------------------------------
```haskell                              ```haskell
"\.\([[:alpha:]][[:alnum:]-_:\.]*\)"    identifier = do
```                                       first <- letter
                                          rest <- many $ alphaNum <|>
oneOf "-_:."
                                          return (first:rest)
                                        ```
--------------------------------------------------------------------------------

The output of running this through Pandoc and telling it to output the
Native Haskell representation is:

Table [] [AlignCenter,AlignCenter] [0.4375,0.5625]
 [[Plain [Str "Regular",Space,Str "Express"]]
 ,[Plain [Str "Parser",Space,Str "Combinators"]]]
 [[[Plain [Code ("",[],[]) "haskell \"\\.\\([[:alpha:]][[:alnum:]-_:\\.]*\\)"]]
  ,[Plain [Code ("",[],[]) "haskell \"    identifier = do first <-
letter rest <- many $ alphaNum <|> oneOf \"-_:.\" return
(first:rest)"]]]]

(Note that if I use ~ rather than ` for the code block, it instead
parses it as a subscript.)

If I try to manually create a table:

Table [] [AlignCenter,AlignCenter] [0.4375,0.5625]
[[Plain [Str "Regular",Space,Str "Express"]]
,[Plain [Str "Parser",Space,Str "Combinators"]]]
[[[Plain [Code ("",["haskell"],[]) "foo"]]
 ,[Plain [Code ("",["haskell"],[]) "identifier = do first <- letter\n
rest <- many $ alphaNum <|> oneOf \"-_:.\"\nreturn (first:rest)"]]]]

The resulting Markdown is then:

  ------------------------------------------------------------------------
          Regular Express                    Parser Combinators
  ------------------------------- ----------------------------------------
          `foo`{.haskell}             `identifier = do first <- letter
                                   rest <- many $ alphaNum <|> oneOf "-_:.
                                                     "
                                       return (first:rest)`{.haskell}
  ------------------------------------------------------------------------

(It isn't obvious from this snippet, but this table appears right
after the previous line, rather than leaving a blank line as required
for multiline tables.)

Is there any way to achieve what I want?

-- 
Ivan Lazar Miljenovic
Ivan.Miljenovic-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
http://IvanMiljenovic.wordpress.com


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

end of thread, other threads:[~2015-07-20 17:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-20 13:17 Fenced code blocks in multiline tables Ivan Lazar Miljenovic
     [not found] ` <CA+u6gbzerR6py_HuF1fw273NMPzT+sqH3pvw38vP=2p9sv7jrA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-07-20 17:07   ` kurt.pfeifle-gM/Ye1E23mwN+BqQ9rBEUg

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