Giter VIP home page Giter VIP logo

Comments (10)

Scorpiion avatar Scorpiion commented on September 22, 2024

I don't know anything about the details here, I don't know what css class names are used at the moment.

However just reading this I got a initial thought on the class names. Isn't both "math" and "display" very wide names (or so to speak) that might create issues? That is collisions with css names created by the end user.

I'm thinking that some kind of prefix of the css class name might be beneficial, especially if those class names are always machine generated (since the length of the machine generated names does not effect the end user, while using name they might also use can create hard to find bugs). As far as I know in normal css the namespace is always global, that's why these collisions might happen. Mdl for example prefixes all their css classes with mdl-. Maybe just md- could be used if there is not already some prefix used in md_proc overall.

from mdown.

kasperpeulen avatar kasperpeulen commented on September 22, 2024

@Scorpiion I think that is a good point, the current behaviour of md_proc is that it adds the classes math inline or math display. But I think this may not be optimal indeed.

For my personal project, I don't need any class names, it just has to be escaped from the regular markdown parser. Mathjax will search for the latex the math delimeters, not for a class name.

from mdown.

Scorpiion avatar Scorpiion commented on September 22, 2024

Okay, yeah I think a css prefix might be good then. It might not be an issue for smaller projects, especially in the beginning, however the bigger the project gets the bigger the risk is that someone will run into this. It could also be that you are using the css of another third party, that you don't control, and that one uses one of more names that collide.

I might have "hijacked" this issue a little bit, so I created a separate issue (#14) for the potential of adding a css class name prefix to md_proc.

I suggest any further thoughts or discussion on css prefixes could be done there instead. Would like to hear what you think about css classes @dikmax when you have some time to spare.

from mdown.

dikmax avatar dikmax commented on September 22, 2024

@kasperpeulen I don't quite understand why you may want to use \begin{}..\end{} instead of $$..$$. If you need complete LaTeX syntax why not to use just it. What the point of mixing those syntaxes.

What is supposed HTML-output for such blocks? If it just escaping then I think code block already support it.

from mdown.

dikmax avatar dikmax commented on September 22, 2024

BTW, Pandoc also have raw_tex extension. But it strips all TeX-blocks from HTML-output.

from mdown.

kasperpeulen avatar kasperpeulen commented on September 22, 2024

@dikmax This is not really about having complete LaTeX syntax. It is only for the math LaTeX blocks. For example this how it works in math.stackexchange.com:


image


But in my editor it works now like this:


image


The markdown is not escaped. So basically for math.stackexchange.com they use a markdown flavour that escapes everything between those \begin{} ... \end{} blocks. In theory I only need the following:

align      
align* 
alignat      
alignat*        
aligned       
alignedat      
array

Bmatrix
bmatrix

cases
CD                    

eqnarray
eqnarray*
equation
equation*

gather             
gather* 
gathered   

matrix
multline   
multline*   

pmatrix

smallmatrix 
split              
subarray  

Vmatrix
vmatrix

Those are the environment blocks that mathjax accepts. But I guess it would be easier to just escape any environment block.

What is supposed HTML-output for such blocks? If it just escaping then I think code block already support it.

So I think that this:

This is the identity matrix:

\begin{pmatrix}
1 & 0 & 0 \\
0 & 1 & 0 \\
0 & 0 &1 \\
\end{pmatrix}

Should be converted to:

<p>This is the identity matrix:</p>
<p>
  <span class="math display">\begin{pmatrix}
1 & 0 & 0 \\
0 & 1 & 0 \\
0 & 0 &1 \\
\end{pmatrix}</span>
</p>

The span around is not strictly necessary for my case, but I think it could be useful for some cases (maybe for me in the future as well). I'm not sure sure about the class names. Maybe a prefix would be better.

from mdown.

kasperpeulen avatar kasperpeulen commented on September 22, 2024

Btw about class names, it could make sense, to give all math blocks tex2jax_process. This is the default for classes that mathjax processes:

http://docs.mathjax.org/en/latest/options/tex2jax.html?highlight=tex2jax_process

I think then the extension may be called MathJax because this is very specific for mathjax. It doesn't work like that for KaTeX for example.

from mdown.

dikmax avatar dikmax commented on September 22, 2024

@kasperpeulen I've checked how Pandoc handles raw TeX.
Your is rendered as:

<p>This is the identity matrix:</p>

\begin{pmatrix}
1 &amp; 0 &amp; 0 \\
0 &amp; 1 &amp; 0 \\
0 &amp; 0 &amp;1 \\
\end{pmatrix}

I think, I'll do same.

from mdown.

kasperpeulen avatar kasperpeulen commented on September 22, 2024

@dikmax sorry for the late reply, but that would work fine for my use case :)

from mdown.

dikmax avatar dikmax commented on September 22, 2024

Fixed in 0.8.1. Please tell me it some of blocks aren't parsed correctly.

from mdown.

Related Issues (14)

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.