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

add ext argument to md_document #1715

Merged
merged 2 commits into from
Dec 2, 2019
Merged

Conversation

atusy
Copy link
Collaborator

@atusy atusy commented Dec 2, 2019

This PR generalizes md_document by adding ext argument, so that we can generate a wide variety of formats.
Below is an example YAML frontmatter to generate pdf with ConTeXt.

---
output:
  md_document:
    variant: context
    ext: ".pdf"
---

@cderv
Copy link
Collaborator

cderv commented Dec 2, 2019

@atusy does this mean for you md_document can be used with any output format ?

If I may share some thoughts about that:

It feels strange that this function designed for creating markdown output can be used for creating pdf too. From my understanding, variant for md_document seems to correspond more to Pandoc Markdown Variants and context is not one of them. It should be pdf_engine or pandoc_to to be consistent with pandoc MANUAL I guess. Using md_document as a generic output format is not the clearer. Rmarkdown works well with one function for one output type. Mixing things would mean maybe less easy to maintain in the future.

I think I would go with a more specific format with correct pandoc args, pre-processor and post-processor. It can be more suited for supporting ConText. What do you think ?

💭 Just sharing thoughts with you on this - I find it interesting when people share their concerns with me regarding my suggestions, hope it is fine with you. Cheers.

@atusy
Copy link
Collaborator Author

atusy commented Dec 2, 2019

I'm happy to listen to your thoughts.
To be honest, I also have the strange feeling LOL.
Despite of it, I made this PR because we have bookdown::markdown_document2, which shares the context of "generalization".

Let me explain why I come up with this PR.

  • Using variant for non-markdown output is sometimes useful.
    For example, variant: native renders native Haskell, and might be helpful on writing Pandoc filters.
  • Generalized md_document can be a workaround to output formats that Pandoc supports, but the rmarkdown package does not support yet.

Anyway, This PR is not urging. I totally agree that one function for one output is a better desgin.

Copy link
Member

@yihui yihui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR looks simple enough, so I'll merge it. I agree it may not be an optimal solution to #1713. Thank you both!

@yihui yihui merged commit f6961af into rstudio:master Dec 2, 2019
@atusy atusy deleted the generalize-mddoc branch December 3, 2019 05:13
yihui pushed a commit to cderv/rmarkdown that referenced this pull request Dec 3, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants