-
Notifications
You must be signed in to change notification settings - Fork 176
-
Notifications
You must be signed in to change notification settings - Fork 176
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
Exporting manubot manuscript to Rmd #381
Comments
Adding more information to include examples! The RMarkdown might look something like this:
The references.json looks like this:
And the citations.tsv looks like this:
|
Andddd in posting this update, I realized that replacing
with
Allows Rmd/pandoc-citeproc to see the citation appropriately, so I just need to programmatically replace the |
This comment has been minimized.
This comment has been minimized.
My above comment is wrong and applied to an old version of Manubot. Now that pandoc-manubot-cite is its own pandoc filter I see two options. Calling the pandoc-manubot-cite filter from RmarkdownAs per the docs at https://rmarkdown.rstudio.com/docs/articles/lua-filters.html, you might be able to add something like the following in your Rmarkdown document ---
output:
html_document:
pandoc_args:
- --filter=pandoc-manubot-cite
- --filter=pandoc-citeproc
--- The pandoc options used by Manubot are specified at https://github.com/manubot/rootstock/blob/8b9b5ced2c7c963bf3ea5afb8f31f9a4a54ab697/build/pandoc/defaults/common.yaml Running pandoc to export to markdownHere is the command Manubot runs to export to HTML. I think what you want is to export to markdown, so possibly: pandoc --verbose \
--data-dir="$PANDOC_DATA_DIR" \
--defaults=common.yaml \
--to=markdown \
--output=output/manuscript-post-filters.md Haven't tested this, but the goal is to run the pandoc-manubot-cite filter to process the citations but to write to markdown and not HTML. I think this option might be better than 1. Haven't tested either, but happy to help debug any issues. Option 2 should also run the other pandoc filters to number figures, tables, and equations. |
One thing we might consider is adding an opt-in BUILD_MD option to rootstock, so you could enable this environment variable and get a more portable markdown output. One question would be which markdown to export to: markdown (pandocs markdown), commonmark, or commonmark_x. Perhaps this could be an option. Update: I opened PR #382 that demonstrates running pandoc to export to markdown. I think this should get you what you need (running the filters for citations and figure/table/equation numbering) |
Okay, I think the following code in #382 will create a markdown file you can use with RMarkdown: Lines 38 to 43 in 6645e8b
Let us know how that works. |
Hello! I recently used manubot to draft a collaborative document, it was a wonderful experience -- thank you for generating such a great tool! I now find need to export the manuscript to Rmarkdown. Using the output
manuscript.md
, I find with very few changes that everything knits appropriately and generates a rendered pdf of the document. However, I could not get citations to render properly. When I knit usingbibliography: references.json
, I get output like:It seems like there is enough information output by manubot between
markdown.md
,references.json
, andcitations.tsv
that citations/references in Rmarkdown might work relatively easily, but I couldn't figure out how to make this work. My current plan is to replace all of the ~125 citations by hand with bibtex references and generate a new bibliography, but I would love to avoid this if at all possible!The text was updated successfully, but these errors were encountered: