+
Skip to content

markdown_html() injects \n #39

Closed
Closed
@JosiahParry

Description

@JosiahParry

I'm finding that using commonmark:markdown_html() injects many additional "\n" instead of terminating a <p> tag.

Take this for example:

commonmark::markdown_html(
  c(
    "This is item one",
    "This is item two"
  )
) 
#> [1] "<p>This is item one\nThis is item two</p>\n"

Created on 2025-06-15 with reprex v2.1.1

I would expect this to become <p>This is item one</p> <p>This is item two</p> but instead there is a new line injected in between. Setting hardbreak = TRUE only adds a <br /> where the first \n is.

My expectation was that each element in the character vector would be parsed independently. Is there a way to accomplish this with the commonmark package?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载