Skip to content

Markdown: handling of equations? #520

Closed

Description

@privefl

Would it be possible to have the "equation feature" also?
For example,

\[x^2 + y^2 = z^2\]

or

$x^2 + y^2 = z^2$

Anyway, this is a nice feature to be able to use Markdown in roxygen!

Activity

  1. gaborcsardi commented on Oct 21, 2016

    @gaborcsardi
    Member

    I think this is a good idea. Unfortunately equations are not supported by the commonmark parser that we use:

    ❯ cat(markdown_xml("Foo \\[x^2 + y^2 = z^2\\] bar"))
    #> <?xml version="1.0" encoding="UTF-8"?>
    #> <!DOCTYPE document SYSTEM "CommonMark.dtd">
    #> <document xmlns="http://commonmark.org/xml/1.0">
    #>   <paragraph>
    #>     <text>Foo </text>
    #>     <text>[</text>
    #>     <text>x^2 + y^2 = z^2</text>
    #>     <text>]</text>
    #>     <text> bar</text>
    #>   </paragraph>
    #> </document>
    
    ❯ cat(markdown_xml("Foo $x^2 + y^2 = z^2$ bar"))
    #> <?xml version="1.0" encoding="UTF-8"?>
    #> <!DOCTYPE document SYSTEM "CommonMark.dtd">
    #> <document xmlns="http://commonmark.org/xml/1.0">
    #>   <paragraph>
    #>     <text>Foo $x^2 + y^2 = z^2$ bar</text>
    #>   </paragraph>
    #> </document>

    Equations were discussed several times at the commonmark forum, but AFAIK nobody wrote any code to support them.
    https://talk.commonmark.org/t/mathematics-extension/457/29
    https://talk.commonmark.org/t/mathjax-extension-for-latex-equations/698/16
    https://talk.commonmark.org/t/ignore-latex-like-math-mode-or-parse-it/1926

    Note that \eqn and deqn are still supported in markdown mode, so you can just write equations that way for now, until commonmark gets proper equation support. It would probably also help if someone volunteered to implement it for them. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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