public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Why become simple square brackets escaped and how to turn this off?
@ 2019-07-31 22:44 'Marcel Otto' via pandoc-discuss
       [not found] ` <71debaa3-7564-4fbe-99e8-0157dc63ea12-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: 'Marcel Otto' via pandoc-discuss @ 2019-07-31 22:44 UTC (permalink / raw)
  To: pandoc-discuss


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

Hi,

why does Pandoc escape simple square brackets?

$ echo "[Foo]" | pandoc --from=markdown --to=markdown
\[Foo\]

Since some Markdown tools will interpret this as LaTeX math, I don't want 
to lose portability and turn this behaviour off. Is this possible somehow?

Thanks in advance,
Marcel

-- 
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/71debaa3-7564-4fbe-99e8-0157dc63ea12%40googlegroups.com.

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

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

* Re: Why become simple square brackets escaped and how to turn this off?
       [not found] ` <71debaa3-7564-4fbe-99e8-0157dc63ea12-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2019-08-01  0:13   ` John MacFarlane
  0 siblings, 0 replies; 2+ messages in thread
From: John MacFarlane @ 2019-08-01  0:13 UTC (permalink / raw)
  To: 'Marcel Otto' via pandoc-discuss, pandoc-discuss


"'Marcel Otto' via pandoc-discuss"
> Hi,
>
> why does Pandoc escape simple square brackets?
>
> $ echo "[Foo]" | pandoc --from=markdown --to=markdown
> \[Foo\]

Because [Foo] can otherwise be interpreted as a reference link.

> Since some Markdown tools will interpret this as LaTeX math, I don't want 
> to lose portability and turn this behaviour off. Is this possible somehow?

3 solutions, none pretty:

1) Use sed on the output to substitute [ for \[, etc.

2) Write a lua filter that splits up Str elements containing [
or ] and replaces these with a RawInline Markdown element with
the character.  (Raw markdown gets passed through and won't be
escaped.)

3) Write `[`{=markdown}Foo`]`{=markdown} in your document.


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

end of thread, other threads:[~2019-08-01  0:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-31 22:44 Why become simple square brackets escaped and how to turn this off? 'Marcel Otto' via pandoc-discuss
     [not found] ` <71debaa3-7564-4fbe-99e8-0157dc63ea12-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2019-08-01  0:13   ` 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).