# HTML Output from Markdown Examples

##

###

This vignette shows how the output looks like in HTML from the other vignette `markdown-examples.Rmd`, in which the literal HTML code was shown.

    library(markdown)

    # toc example
    mkd <- c("# Header 1", "p1", "## Header 2", "p2")

    cat(mark(mkd, options = "+number_sections"))

# 1. Header 1

p1

## 1.1 Header 2

p2

    cat(mark(mkd, options = "+number_sections+toc"))

# 1. Header 1

p1

## 1.1 Header 2

p2

    # hard_wrap example
    cat(mark("foo\nbar\n"))

foo bar

    cat(mark("foo\nbar\n", options = "hard_wrap"))

foo
bar

    # latex math example
    mkd <- c(
      "`$x$` is inline math $x$!", "", "Display style:", "", "$$x + y$$", "",
      "\\begin{eqnarray}
    a^{2}+b^{2} & = & c^{2}\\\\
    \\sin^{2}(x)+\\cos^{2}(x) & = & 1
    \\end{eqnarray}"
    )

    cat(mark(mkd))

`$x$` is inline math \(x\)!

Display style:

$$x + y$$

\begin{eqnarray} a^{2}+b^{2} & = & c^{2}\\ \sin^{2}(x)+\cos^{2}(x) & = & 1 \end{eqnarray}

    cat(mark(mkd, options = "-latex_math"))

`$x$` is inline math $x$!

Display style:

$$x + y$$

\begin{eqnarray} a^{2}+b^{2} & = & c^{2}\ \sin^{2}(x)+\cos^{2}(x) & = & 1 \end{eqnarray}

    # tables example (need 4 spaces at beginning of line here)
    cat(mark("
    First Header  | Second Header
    ------------- | -------------
    Content Cell  | Content Cell
    Content Cell  | Content Cell
    "))

First Header | Second Header
--- | ---
Content Cell | Content Cell
Content Cell | Content Cell

    # but not here
    cat(mark("
    First Header  | Second Header
    ------------- | -------------
    Content Cell  | Content Cell
    Content Cell  | Content Cell
    ", options = '-table'))

First Header | Second Header ———–– | ———–– Content Cell | Content Cell Content Cell | Content Cell

    # autolink example
    cat(mark("https://www.r-project.org/"))

https://www.r-project.org/

    cat(mark("https://www.r-project.org/", options = "-autolink"))

https://www.r-project.org/

    # strikethrough example
    cat(mark("~~awesome~~"))

awesome

    cat(mark("~~awesome~~", options = "-strikethrough"))

~~awesome~~

    # superscript and subscript examples
    cat(mark("2^10^"))

210

    cat(mark("2^10^", options = "-superscript"))

210

    cat(mark("H~2~O"))

H2O

    cat(mark("H~2~O", options = "-subscript"))

H2O

    # skip_html tags
    mkd = '<style>a {}</style><script type="text/javascript">console.log("No!");</script>\n[Hello](#)'
    cat(mark(mkd))

Hello

    # TODO: wait for https://github.com/r-lib/commonmark/issues/15 to be fixed
    # cat(mark(mkd, options = "tagfilter"))

    # smartypants example
    cat(mark("1/2 (c)"))

½ ©

    mkd <- paste(names(markdown:::pants), collapse = ' ')
    cat(mark(mkd))

½ ⅓ ⅔ ¼ ¾ ⅕ ⅖ ⅗ ⅘ ⅙ ⅚ ⅛ ⅜ ⅝ ⅞ ⅐ ⅑ ⅒ © ® ™