Giter Site home page Giter Site logo

Comments (6)

jgm avatar jgm commented on June 7, 2024 1

Note that you can always turn off the raw attribute extension:
-t markdown-raw_attribute.

from pandoc.

jgm avatar jgm commented on June 7, 2024 1

I've changed the writer so it doesn't use raw_attribute syntax unless there is no other option.

from pandoc.

jgm avatar jgm commented on June 7, 2024

However this won't render correctly.

Can you expand on this? How are you rendering this md document?

So my suggestion would be to not extend latex macros if the output format has explicitily activated the extension latex_macros

The expansion takes place in the reader. By the time the writer gets it, it has already been expanded and there is nothing the writer can do to "unexpand" it. So, this needs to be a reader extension.

from pandoc.

asmaier avatar asmaier commented on June 7, 2024

However this won't render correctly.

Can you expand on this? How are you rendering this md document?

I was using

 pandoc --mathjax -s -f markdown -t html5 -o test.html test.md

But this will not work correctly, because the \newcommands will be ignored.

So my suggestion would be to not extend latex macros if the output format has explicitily activated the extension latex_macros

The expansion takes place in the reader. By the time the writer gets it, it has already been expanded and there is nothing the writer can do to "unexpand" it. So, this needs to be a reader extension.

Ok, I understand. I was more thinking about a "readable" command line, ignoring the inner workings of pandoc. I still think it would be nice if the result in the markdown file would look like

    \newcommand{\lra}[1]{ \left( #1 \right) }
    \newcommand{\lrb}[1]{ \left[ #1 \right] }
    \newcommand{\lrc}[1]{ \left\{ #1 \right\} }

instead of

    ```{=latex}
    \newcommand{\lra}[1]{ \left( #1 \right) }
    ```
    ```{=latex}
    \newcommand{\lrb}[1]{ \left[ #1 \right] }
    ```
    ```{=latex}
    \newcommand{\lrc}[1]{ \left\{ #1 \right\} }
    ```

so that the latex macros won't get ignored when rendering the markdown.

from pandoc.

jgm avatar jgm commented on June 7, 2024

so that the latex macros won't get ignored when rendering the markdown.

Right. I guess that's something I hadn't considered in telling the Markdown writer to use the raw attribute syntax. We could (a) in the markdown writer, avoid using the raw attribute syntax, at least for macro definitions, or (b) in the markdown reader, process macros even when in raw blocks.

from pandoc.

asmaier avatar asmaier commented on June 7, 2024

From a user perspective I would choose option (a), because it leads to a simpler markdown file.

from pandoc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.