You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am writing a document with nested lists, like this:
1. (a) foo
(b) bar
---
1. asdf
(a) foo
(b) bar
When I render to a PDF, it looks as I would like. The first line contains "1. (a) foo".
When I render to HTML, there is a line break after "1.". However, the HTML appears semantically to match what I wrote, so I suppose this is just a quirk of HTML rendering.
When I render to docx, the first line is "(a) foo" and the number has disappeared. I am not sure if the effect can be easily achieved in Word, while still using its list facilities. If it can, that would be my preference. If not, maybe something closer to the HTML rendering, which can be achieved at the cost of a line break, would be better?
I think that your example produces an acceptable rendering in Word of
my original example. (Or at least, as good as one might hope for,
given Word's apparent limitation here.)
To clarify:
I'd like to get that rendering from my original input, so that I can
get the "right" output where supported (PDF) and the best fallback
where not supported (HTML, docx).
I'm not sure if that would upset anyone who might be relying on the
existing behaviour, although I'd be surprised if it was what they
really wanted.
You could use a filter or lua filter to add the nonbreaking space when output is docx.
--- fixlist.lua
function OrderedList(el)
if FORMAT=='docx' then
if el.content[1] and el.content[1][1].t == 'OrderedList' then
table.insert(el.content[1], 1, pandoc.Plain{pandoc.Str""})
end
return el
end
end
I am writing a document with nested lists, like this:
When I render to a PDF, it looks as I would like. The first line contains "1. (a) foo".
When I render to HTML, there is a line break after "1.". However, the HTML appears semantically to match what I wrote, so I suppose this is just a quirk of HTML rendering.
When I render to docx, the first line is "(a) foo" and the number has disappeared. I am not sure if the effect can be easily achieved in Word, while still using its list facilities. If it can, that would be my preference. If not, maybe something closer to the HTML rendering, which can be achieved at the cost of a line break, would be better?
I am using pandoc 2.8.0.1:
pandoc -o number.docx number.md
number.docx
number.pdf
The text was updated successfully, but these errors were encountered: