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 does not render footnotes from abstract when passing from metadata-file #7813

Closed
fatpat opened this issue Jan 7, 2022 · 5 comments
Closed

Comments

@fatpat
Copy link

fatpat commented Jan 7, 2022

Explain the problem.
When exporting from markdown to docx, I want to use a custom abstract with footnotes inside.
Depending how the abstract metadata is passed, footnotes are rendered correctly or not.

here is the content of my file bug.md

# title

content

here is the content of my metadata bug.metadata.yml:

---
title: This a real nice title
author: someone
abstract: |
    this **is** the footnote[^1] in the abstract.
    
    [^1]: this is a footnote content
---

Now, depending on how I call pandoc, the generated docx is not the same:

  • pandoc bug.md --metadata-file=bug.metadata.yml -o bug.docx: the footnote is not rendered and the astract contains this is the footnote[^1] in the abstract.
  • cat bug.metadata.yml bug.md | pandoc -f markdown -o bug.docx: in this case the footnote is rendered correctly and everything is rendered as expected.

I am in a more complex scenario with multiple metadata files and I was expecting metadata-file to work with footnotes in the abstract.

For testing, I also try to set up the abstract from the command line with --metadata:

  • pandoc bug.md --metadata="abstract:this **is** the footnote[^1] in the abstract.\n\n[^1]: this is the footnote content" -o bug.docx: abstract is not even markdown interpreted and it is rendered as-is in the docx output.

Pandoc version?

$ pandoc --version
pandoc 2.14.0.3
Compiled with pandoc-types 1.22.1, texmath 0.12.3.2, skylighting 0.10.5.2,
citeproc 0.4.0.1, ipynb 0.1.0.2
User data directory: /home/xxxx/.local/share/pandoc
Copyright (C) 2006-2021 John MacFarlane. Web:  https://pandoc.org
This is free software; see the source for copying conditions. There is no
warranty, not even for merchantability or fitness for a particular purpose.
@fatpat fatpat added the bug label Jan 7, 2022
@jgm
Copy link
Owner

jgm commented Jan 7, 2022

--metadata is not markdown interpreted, so that's expected. But --metadata-file should work, at least based on what the manual says: "This option can be used with every input format, but string scalars in the YAML file will always be parsed as Markdown." This looks like a regression (still present in HEAD), but we need to do some bisecting to figure out where it got introduced.

@jgm
Copy link
Owner

jgm commented Jan 7, 2022

Well, I guess it is being parsed as Markdown (at least the strong emphasis is). The problem is specific to footnotes.

@jgm
Copy link
Owner

jgm commented Jan 7, 2022

Interestingly, inline notes seem to work okay.

@jgm
Copy link
Owner

jgm commented Jan 7, 2022

I think we need to change line 83 of src/Text/Pandoc/Readers/Markdown.hs.
(We need to do the plumbing done in parseMarkdown, not just parseBlocks.)

@jgm jgm closed this as completed in a965111 Jan 7, 2022
@fatpat
Copy link
Author

fatpat commented Jan 8, 2022

Thank you very much !!

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

2 participants