public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: Ian Allen <idallen-4AaKEnNpRjew5LPnMra/2Q@public.gmane.org>
To: pandoc-discuss <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: pandoc adds awkward HTML newlines inside inline verbatim backticks
Date: Mon, 19 Sep 2022 02:21:33 -0700 (PDT)	[thread overview]
Message-ID: <18a76e36-b390-4dff-8ee7-68623df03ad0n@googlegroups.com> (raw)


[-- 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 --]

             reply	other threads:[~2022-09-19  9:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-19  9:21 Ian Allen [this message]
     [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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=18a76e36-b390-4dff-8ee7-68623df03ad0n@googlegroups.com \
    --to=idallen-4aakennprjew5lpnmra/2q@public.gmane.org \
    --cc=pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).