-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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 reader: bookmark in header not working when last parPart was a bookmark #9626
Labels
Comments
Go for it! |
Thanks! |
mbrackeantidot
added a commit
to mbrackeantidot/pandoc
that referenced
this issue
Apr 4, 2024
When the last parPart before a header was a bookmark, no span with an anchor was added for a bookmark in the header. But the function that adds header anchors to the anchor map, needs a span with an anchor. So this commit adds that span.
mbrackeantidot
added a commit
to mbrackeantidot/pandoc
that referenced
this issue
Apr 4, 2024
When the last parPart before a header was a bookmark, no span with an anchor was added for a bookmark in the header. But the function that adds header anchors to the anchor map, needs a span with an anchor. So this commit adds that span.
jgm
pushed a commit
that referenced
this issue
Apr 18, 2024
When the last parPart before a header was a bookmark, no span with an anchor was added for a bookmark in the header. But the function that adds header anchors to the anchor map, needs a span with an anchor. So this commit adds that span.
I believe that the merged PR #9626 fixed this. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Explain the problem.
When transforming this document: bookmark_simplified.docx with pandoc using
pandoc bookmark_simplified.docx
, the link at the start of the file is not correctly transformed.Expected ouptut:
Actual output:
I found out that this is because the last paragraph part before the header is a bookmark. In this case,
parPartToInlines'
doesn't create a span for the bookmark because there is a bookmark immediately before the header (represented bydocxImmedPrevAnchor
) and doesn't add the bookmark to the anchor mapdocxAnchorMap
because it's in a header, which is handled bymakeHeaderAnchor'
. ButmakeHeaderAnchor'
assumes that a span with an anchor was added byparPartToInlines'
.To verify my understanding of the problem, I implemented a fix and tested it manually. If you're curious, the code can be found here: 09fc204
I would like to create a proper commit containing that fix and make a pull request. Do I have your blessing?
Pandoc version?
Latest development version, compiled from source on macOS. Older versions on Linux and macOS had the same bug.
The text was updated successfully, but these errors were encountered: