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

Switch to commonmark markdown #1329

Closed
jeroen opened this issue Dec 2, 2016 · 15 comments · Fixed by rstudio/markdown#95
Closed

Switch to commonmark markdown #1329

jeroen opened this issue Dec 2, 2016 · 15 comments · Fixed by rstudio/markdown#95
Labels
feature Feature requests

Comments

@jeroen
Copy link

jeroen commented Dec 2, 2016

The new version of commonmark uses the Github fork of the libcmark library, providing fast and standardized markdown rendering, including support for Github Flavored Markdown extensions (tables, autolinks, strikethough).

commonmark::markdown_html(md_text, extensions = c("table", "autolink"))
commonmark::markdown_latex(md_text, extensions = c("table", "autolink"))

Maybe it could be a better alternative to markdown::markdownToHTML.

@yihui
Copy link
Owner

yihui commented Dec 2, 2016

Thanks for the suggestion! I'll take a look. I think the markdown package will be retired eventually.

@michaelquinn32
Copy link

Hi Yihui!

Could you please revisit this?

The markdown package relies on a version of sundown that is very old and no longer maintained. At Google, we're treating this as a security issue.

We're in a bit of a tough spot:

  • sundown itself can be replaced by the currently-maintained hoedown, but it is a pretty big rewrite if we're going to do that: https://github.com/hoedown/hoedown
  • Or we need to figure out how to remove the markdown package itself from knitr to use commonmark

Since both involve non-trivial amounts of work, it would be nice to know what approach you would prefer.

Best wishes,
Michael

@yihui
Copy link
Owner

yihui commented May 12, 2020

@michaelquinn32 Yes, I'll remove the dependency on markdown. It may take at least a couple of weeks. The trickiest thing will be package vignettes on CRAN. Due to the huge number of reverse dependencies of knitr, I'll have to be extremely cautious to make this transition. Thanks!

@michaelquinn32
Copy link

That's amazing to hear! Thank you.

Let me know if there's anything I can do to help you out.

yihui added a commit that referenced this issue Jun 21, 2020
… use xfun::base64_uri() instead of the unexported markdown:::.b64EncodeFile()

this is the first step to get rid of the dependency on the markdown package (#1329)
@yihui
Copy link
Owner

yihui commented Sep 14, 2020

Hi @michaelquinn32, I heard that you were planning to work on this issue by yourself, and I just want to let you know that we also plan to work on it on our end. I don't have an ETA yet, but my estimate is that it should be done in about two months. If this issue is urgent to you, please feel to let me know and we can certainly prioritize it. Thanks!

@michaelquinn32
Copy link

Thanks for the update!

There's no need to adjust your prioritization. I'll let you know how things go on my end, and I'm really looking forward to seeing this fixed!

@rickyars
Copy link

Following. I'm very interested in this change as markdown is GPL-2.

@yihui
Copy link
Owner

yihui commented Sep 21, 2020

@rickyars Do you mean that you can't use packages licensed under GPL-2? I'm not entirely sure if I'll be able to change the license of the markdown package.

@rickyars
Copy link

Yes. We can't mix code that uses GPL-2 and GPL-3 if we plan to redistribute our work open source. Right now I have some Shiny apps that use knitr and the one piece I can't get around is its dependence on markdown. If you are removing markdown then the issue goes away. Maybe I misunderstood what was you meant when you said "I'll remove the dependency on markdown." Alternatively, have you considered switching to the rmarkdown package?

@yihui
Copy link
Owner

yihui commented Sep 21, 2020

What I meant are:

  1. markdown won't be a hard dependency of knitr in the future (will only be in Suggests instead of Depends).

  2. markdown won't use the sundown C library.

It sounds like 1 will solve your problem?

@rickyars
Copy link

Yes, thank you!

@cderv cderv added the feature Feature requests label Jan 20, 2021
@cderv
Copy link
Collaborator

cderv commented Mar 22, 2021

Just for reference regarding ☝️

markdown won't be a hard dependency of knitr in the future (will only be in Suggests instead of Depends).

This is followed in #1864

@jeroen
Copy link
Author

jeroen commented Mar 22, 2021

Cool. The commonmark package is now part of the r-lib organization: https://github.com/r-lib/commonmark

@yihui
Copy link
Owner

yihui commented Oct 27, 2022

Although this is no longer tightly relevant to knitr, I've retired the C library sundown in markdown, and switched to commonmark as suggested. Thanks!

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Mar 12, 2023
# CHANGES IN markdown VERSION 1.5

- Values of meta variables `title`, `author`, and `date` (if provided)
  will be transformed to the target output format before they are
  passed into templates.

- Fixed the bug that the default CSS was not added to HTML output.

- Removed dependency on the **mime** package.

- Added experimental support for HTML slides:
  `markdown::mark_html(..., meta = list(css = c('default', 'slides'),
  js = 'slides'))`. If you prefer knitting `Rmd` documents in RStudio,
  you may use the output format:

  ```yaml
  output:
    markdown::html_format:
      meta:
        css: [default, slides]
        js: [slides]
  ```

  See https://yihui.org/en/2023/01/minimal-r-markdown/ for a demo.

# CHANGES IN markdown VERSION 1.4

- Empty `\title{}` in LaTeX output will be removed (along with `\maketitle`).

- highlight.js is loaded from
  https://www.jsdelivr.com/package/gh/highlightjs/cdn-release by
  default now. This means more languages are supported (not only R),
  but also means syntax-highlighting will not work offline at the
  moment (it will be improved in future).

- MathJax failed to load in the previous version. The bug has been
  fixed now.

- Removed the function `markdownExtensions()`.

# CHANGES IN markdown VERSION 1.3

- Switched the underlying Markdown rendering engine from the C library
  **sundown** (which has been deprecated for a decade) to the R
  package **commonmark** (thanks, @jeroen, yihui/knitr#1329).

- The functions `renderMarkdown()` and `markdownToHTML()` have been
  renamed to `mark()` and `mark_html()`, respectively. The old names
  are still kept in this package for backward-compatibility.

- Removed the arguments `stylesheet` and `fragment.only` in
  `mark_html()`. For `stylesheet`, please use the argument `meta =
  list(css = ...)` to provide the CSS stylesheet. For `fragment.only`,
  please use `mark_html(template = FALSE)` or `mark_html(options =
  '-standalone')` instead of `fragment.only = TRUE`. Currently these
  old arguments are still accepted internally, but may be deprecated
  and dropped in the long run.

- The `file` argument of `mark()` and `mark_html()` can also take a
  character vector of Markdown text now.

- Removed functions `rendererExists()`, `rendererOutputType()`, and
  `registeredRenderer()`. They were primarily for internal use.

- Deprecated the function `markdownExtensions()`. All extensions
  should be specified via the `options` argument of functions like
  `mark()`, e.g., `mark(options = '+table+tasklist')`. See all options
  on the help page `?markdown::markdown_options`.

- Renamed `markdownHTMLOptions()` to `markdown_options()`.

# CHANGES IN markdown VERSION 1.2

- Fixed the warnings "a function declaration without a prototype is
  deprecated in all versions of C" (#94).
@github-actions
Copy link

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature Feature requests
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants