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

Support task lists when writing docx #5198

Open
agusmba opened this issue Jan 3, 2019 · 3 comments
Open

Support task lists when writing docx #5198

agusmba opened this issue Jan 3, 2019 · 3 comments

Comments

@agusmba
Copy link
Contributor

agusmba commented Jan 3, 2019

The development version of pandoc recently added support for tasklists on markdown and writing html and latex. See #3051

It would be great to support writing task lists in docx.

Currently the default docx behavior doesn't look great:

image

There is an issue with the spacing, and another with long lines. Both could be solved by using specific numbering styles with the proper bullets:

image

4/1/2019 UPDATE!

Here are some xml snippets:

Current pandoc output

document.xml:

<w:p><w:pPr><w:pStyle w:val="Compact" /><w:numPr><w:numId w:val="1002" /><w:ilvl w:val="0" /></w:numPr></w:pPr>
  <w:r><w:t xml:space="preserve">☐ Unchecked task</w:t></w:r></w:p>
<w:p><w:pPr><w:pStyle w:val="Compact" /><w:numPr><w:numId w:val="1002" /><w:ilvl w:val="0" /></w:numPr></w:pPr>
  <w:r><w:t xml:space="preserve">☒ Completed task</w:t></w:r></w:p>

numbering.xml:

<w:abstractNum w:abstractNumId="991"><w:nsid w:val="71315dca" /><w:multiLevelType w:val="multilevel" />
  <w:lvl w:ilvl="0"><w:numFmt w:val="bullet" /><w:lvlText w:val="" /><w:lvlJc w:val="left" />
  <w:pPr><w:tabs><w:tab w:val="num" w:pos="0" /></w:tabs><w:ind w:left="480" w:hanging="480" /></w:pPr></w:lvl>
  <w:lvl w:ilvl="1"><w:numFmt w:val="bullet" /><w:lvlText w:val="" /><w:lvlJc w:val="left" /><w:pPr><w:tabs><w:tab w:val="num" w:pos="720" /></w:tabs><w:ind w:left="1200" w:hanging="480" /></w:pPr></w:lvl><!-- ... -->
</w:abstractNum>
<!-- ... -->
<w:num w:numId="1002"><w:abstractNumId w:val="991" /></w:num>

Fixing it manually at the xml level

document.xml:

-<w:p><w:pPr><w:pStyle w:val="Compact" /><w:numPr><w:numId w:val="1002" /><w:ilvl w:val="0" /></w:numPr></w:pPr>
+<w:p><w:pPr><w:pStyle w:val="Compact" /><w:numPr><w:numId w:val="1003" /><w:ilvl w:val="0" /></w:numPr></w:pPr>
  <w:r><w:t xml:space="preserve">☐ Unchecked task</w:t></w:r></w:p>
-<w:p><w:pPr><w:pStyle w:val="Compact" /><w:numPr><w:numId w:val="1002" /><w:ilvl w:val="0" /></w:numPr></w:pPr>
+<w:p><w:pPr><w:pStyle w:val="Compact" /><w:numPr><w:numId w:val="1004" /><w:ilvl w:val="0" /></w:numPr></w:pPr>
  <w:r><w:t xml:space="preserve">☒ Completed task</w:t></w:r></w:p>

numbering.xml:

<w:abstractNum w:abstractNumId="991"><w:nsid w:val="71315dca" /><w:multiLevelType w:val="multilevel" />
  <w:lvl w:ilvl="0"><w:numFmt w:val="bullet" /><w:lvlText w:val="•" /><w:lvlJc w:val="left" />
  <w:pPr><w:tabs><w:tab w:val="num" w:pos="0" /></w:tabs><w:ind w:left="480" w:hanging="480" /></w:pPr></w:lvl>
  <w:lvl w:ilvl="1"><w:numFmt w:val="bullet" /><w:lvlText w:val="–" /><w:lvlJc w:val="left" /><w:pPr><w:tabs><w:tab w:val="num" w:pos="720" /></w:tabs><w:ind w:left="1200" w:hanging="480" /></w:pPr></w:lvl><!-- ... -->
</w:abstractNum>
+<w:abstractNum w:abstractNumId="992"><w:nsid w:val="71315dcb" /><w:multiLevelType w:val="multilevel" />
+  <w:lvl w:ilvl="0"><w:numFmt w:val="bullet" /><w:lvlText w:val="☐" /><w:lvlJc w:val="left" />
+  <w:pPr><w:tabs><w:tab w:val="num" w:pos="0" /></w:tabs><w:ind w:left="480" w:hanging="480" /></w:pPr></w:lvl>
+  <w:lvl w:ilvl="1"><w:numFmt w:val="bullet" /><w:lvlText w:val="☐" /><w:lvlJc w:val="left" /><w:pPr><w:tabs><w:tab w:val="num" w:pos="720" /></w:tabs><w:ind w:left="1200" w:hanging="480" /></w:pPr></w:lvl><!-- ... -->
+</w:abstractNum>
+<w:abstractNum w:abstractNumId="993"><w:nsid w:val="71315dcc" /><w:multiLevelType w:val="multilevel" />
+  <w:lvl w:ilvl="0"><w:numFmt w:val="bullet" /><w:lvlText w:val="☒" /><w:lvlJc w:val="left" />
+  <w:pPr><w:tabs><w:tab w:val="num" w:pos="0" /></w:tabs><w:ind w:left="480" w:hanging="480" /></w:pPr></w:lvl>
+  <w:lvl w:ilvl="1"><w:numFmt w:val="bullet" /><w:lvlText w:val="☒" /><w:lvlJc w:val="left" /><w:pPr><w:tabs><w:tab w:val="num" w:pos="720" /></w:tabs><w:ind w:left="1200" w:hanging="480" /></w:pPr></w:lvl><!-- ... -->
+</w:abstractNum>
<!-- ... -->
<w:num w:numId="1002"><w:abstractNumId w:val="991" /></w:num>
+<w:num w:numId="1003"><w:abstractNumId w:val="992" /></w:num>
+<w:num w:numId="1004"><w:abstractNumId w:val="993" /></w:num>

This manual editing yields the expected:

image

Note that the checkboxes in the text should be removed.
The code for generating the two new styles could be similar to the already default one included in pandoc.

@Javierieh
Copy link

Thanks for looking into this. I'm not even seeing the checkbox in my docx output. Do I need to enable this feature somewhere?

@agusmba
Copy link
Contributor Author

agusmba commented Apr 30, 2020

What pandoc version are you using?
As you can see in this issue, in its current state it might not be very useful for you anyway.

@Javierieh
Copy link

It must have been some other plugin interfering, now i can see the checkboxes in my doc output. Thanks for reaching out.

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