Comments (10)
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.
@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.
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.
@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.
BTW, Pandoc also have raw_tex extension. But it strips all TeX-blocks from HTML-output.
from mdown.
@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:
But in my editor it works now like this:
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.
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.
@kasperpeulen I've checked how Pandoc handles raw TeX.
Your is rendered as:
<p>This is the identity matrix:</p>
\begin{pmatrix}
1 & 0 & 0 \\
0 & 1 & 0 \\
0 & 0 &1 \\
\end{pmatrix}
I think, I'll do same.
from mdown.
@dikmax sorry for the late reply, but that would work fine for my use case :)
from mdown.
Fixed in 0.8.1. Please tell me it some of blocks aren't parsed correctly.
from mdown.
Related Issues (14)
- Use package:collection for collection comparison HOT 1
- don't process math blocks HOT 6
- Use a prefix for css class names HOT 1
- Update to CommonMark specification 0.23 HOT 1
- Update to CommonMark specification 0.24
- how to enable table transformer HOT 1
- possibiliy to define an extension ? HOT 6
- Update to CommonMark specification 0.20
- Update to CommonMark specification 0.21 HOT 1
- Better Dartdoc. HOT 2
- Update to CommonMark specification 0.22 HOT 1
- Note on UTF-8 and smart punctation HOT 5
- Update GitHub web site - point to pub site HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mdown.