Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Safely use TeX code, define keywords and get the attention ... #723

Closed
wants to merge 3 commits into from
Closed

Conversation

lejafar
Copy link

@lejafar lejafar commented Feb 20, 2016

So I'm creating this thing to make a simple scientific documentation page. For this I am using markdown but needed to get around the use of markdown characters inside TeX equations, so I decided to fork this parser and extend it, maybe It should be made optional?

TeX formulas

Use TeX $\partial_{\mu} A^\mu = 0$ inside markdown without worrying about the special characters.

$$\mathcal{L}=\bar\psi(i\gamma^\mu D_\mu-m)\psi -\frac{1}{4}F_{\mu\nu}F^{\mu\nu}$$

Everything in between $ or $$ will be ignored and can be rendered by KaTeX


These two extensions seemed useful? I don't know ...

Define keyword

:keyword: a word or concept of great significance.

will be rendered to

<dl>
  <dt>keyword:</dt>
  <dd>
      <p>a word or concept of great significance.</p>
  </dd>
</dl>

Alert

>! The auto-render extension isn't part of KaTeX proper, it should be separately included! 

will be rendered to

<div role="alert">
<p>The auto-render extension isn't part of KaTeX proper, it should be separately included!</p>
</div>

@lejafar
Copy link
Author

lejafar commented Feb 28, 2016

A bug #722 was found, so more extensive testing is required ...

@lejafar lejafar closed this Feb 28, 2016
@ViktorQvarfordt
Copy link

What's the status on this? I'd like to be able to use MathJax or KaTeX with marked, but this issue is a showstopper.

@lejafar
Copy link
Author

lejafar commented Aug 27, 2016

You can check out my changes changes f0fd264, this is an earlier commit as I might have been to fast accepting the last pull request. Looking at it now, it wasn't inline with what I actually wanted to do ...

I basically told marked to ignore everything between '$' or '$$' so that I could use '^' and '_' without worries, then I used the auto-renderer to render everything between '$' inline and '$$' in display mode.

It's probably better to render inside marked by changing the renderer method as there might be a reason why the auto-render extension isn't part of KaTeX proper yet. I'm thinking about,

Renderer.prototype.formula = function(tex) {
    return katex.renderToString(tex);
}

@ViktorQvarfordt
Copy link

I see some issues with this. For instance, it does not handle \begin{}..\end{}.

Have a look at my new PR #799 and see what you think.

@ViktorQvarfordt
Copy link

I dislike the idea of interweaving marked and KaTeX. What about support for other math renderers (like MathJax)? What about if markdown is rendered on the server, and math in the browser? I think the markdown rendering and math rendering should be separate, making marked agnostic to how one renders the math.

Also, note that does have auto-render like MathJax: https://github.com/Khan/KaTeX/tree/master/contrib/auto-render

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants