public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* pandoc adds awkward HTML newlines inside inline verbatim backticks
@ 2022-09-19  9:21 Ian Allen
       [not found] ` <18a76e36-b390-4dff-8ee7-68623df03ad0n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Ian Allen @ 2022-09-19  9:21 UTC (permalink / raw)
  To: pandoc-discuss


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

This is my input using inline verbatim backticks:
~~~~~
% Test file one

`unbroken line of code` and
`unbroken line of code` and
`unbroken line of code` and
`unbroken line of code` and
`unbroken line of code` and
`unbroken line of code` and
`unbroken line of code` and
`unbroken line of code` and
~~~~~
Command line: `pandoc -s i.md -o i.html`

In the HTML output, pandoc inserts unhelpful newlines in the middle of the 
code elements (excerpt from `i.html` output file):
~~~~~
<p><code>unbroken line of code</code> and <code>unbroken line of
code</code> and <code>unbroken line of code</code> and <code>unbroken
line of code</code> and <code>unbroken line of code</code> and
<code>unbroken line of code</code> and <code>unbroken line of
code</code> and <code>unbroken line of code</code> and</p>
~~~~~
Pandoc uses `code{white-space: pre-wrap;}` to format code, and so my 
browser [preserves the newlines](
https://developer.mozilla.org/en-US/docs/Web/CSS/white-space) that pandoc 
unhelpfully added:
~~~~~
unbroken line of code and unbroken line of
code and unbroken line of code and unbroken
line of code and unbroken line of code and unbroken line of code and 
unbroken line of
code and unbroken line of code and
~~~~~
This is not pretty and I can't imagine anyone would want this output with 
the added newlines placed there randomly by pandoc.  I did not add those 
newlines.  (I can't protect the spaces by with backslashes inside a 
verbatim element; the backslashes are treated literally.)

What I want is pandoc HTML output that does not add extra newlines in the 
middle of code elements.  For example, this would work as HTML output:
~~~~~
<p><code>unbroken line of code</code> and <code>unbroken line of code</code>
and <code>unbroken line of code</code> and <code>unbroken line of 
code</code>
and <code>unbroken line of code</code> and <code>unbroken line of 
code</code>
and <code>unbroken line of code</code> and <code>unbroken line of 
code</code>
and</p>
~~~~~
Then I would be able to choose between `code{white-space: pre-wrap;}` and `code{white-space: 
pre;}` to format the code elements:
~~~~~
`this is a standard pandoc verbatim element that wraps on output` but
`this is one that I can tag and use my own CSS not to wrap`{.mycode}
~~~~~
*For the wish list*: I wish that there were a clean way to write inline 
verbatim elements that could distinguish between `pre-wrap` and `pre` 
without having to tag them all with `{.mycode}`.  I have teaching materials 
full of inline verbatim example shell command lines (such as `ls -l /usr/bin`) 
and I don't want newlines inserted into the middle of those examples, and I 
don't want them to wrap on output, either.  

-- 
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/18a76e36-b390-4dff-8ee7-68623df03ad0n%40googlegroups.com.

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

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

end of thread, other threads:[~2022-09-20 19:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-19  9:21 pandoc adds awkward HTML newlines inside inline verbatim backticks Ian Allen
     [not found] ` <18a76e36-b390-4dff-8ee7-68623df03ad0n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-09-19 16:23   ` John MacFarlane
     [not found]     ` <65F8BFF6-B443-4A24-836F-5D0706159EFB-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2022-09-20  0:40       ` Ian Allen
     [not found]         ` <509c8bfc-034d-4bfa-8227-87e253d9ca80n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-09-20 19:00           ` BPJ
     [not found]             ` <CADAJKhAt93qO8f3yDk8irfr6k05s+K_W+CbkK3tUcBUDa8U2ZQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-09-20 19:10               ` wanting a clean way to write inline verbatim elements with/without wrap Ian Allen
     [not found]                 ` <2c037fb7-c3d3-42bf-8ac8-8a9f0ffe650bn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-09-20 19:16                   ` Albert Krewinkel

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