Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docx writer: Multiple initial list levels not rendered #5948

Closed
martinlester opened this issue Nov 29, 2019 · 4 comments
Closed

Docx writer: Multiple initial list levels not rendered #5948

martinlester opened this issue Nov 29, 2019 · 4 comments

Comments

@martinlester
Copy link

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 am using pandoc 2.8.0.1:

pandoc -o number.docx number.md

number.docx
number.pdf

@agusmba
Copy link
Contributor

agusmba commented Nov 29, 2019

I don't think word supports that.

Would

1.  

   (a) foo

   (b) bar

yield an acceptable result?

@martinlester
Copy link
Author

martinlester commented Nov 29, 2019 via email

@jgm
Copy link
Owner

jgm commented Nov 29, 2019

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

@jgm
Copy link
Owner

jgm commented Nov 29, 2019

I think it would be reasonable to change the docx writer so it does this automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants