lzanini / mdbook-katex

A preprocessor for mdBook, rendering LaTex equations to HTML at build time.
MIT License
205 stars 34 forks source link

$ symbol in the code block should not be parsed #9

Closed imxood closed 1 year ago

imxood commented 3 years ago

it is rendered wrongly in math expressiones code block

for example:

``` $\omega$ ```

it will is: image

lzanini commented 3 years ago

What is a math expressiones code block ? I am not sure what you are trying to achieve here

imxood commented 3 years ago

What is a math expressiones code block ? I am not sure what you are trying to achieve here

for example:

image

image

I expect: the ``` code block is not parsed~ I expect: $x^4$ ``` in code block is kept ~

lzanini commented 3 years ago

What is the point of code block quotes then ?

imxood commented 3 years ago

What is the point of code block quotes then ?

It is one of the writing forms of markdown code block

like this:

int main(int argc, char const *argv[])
{
    /* code */
    return 0;
}
```

``` echo $PATH ```

``` $PATH ```
lzanini commented 3 years ago

Sorry, what I meant was: what is the point of adding code blocks around Tex equations, if what you want to achieve is simply an equation ? And why should "ignore code block" in that situation be the expected behavior ?

If you want to render equation within a code block, I don't think this is possible

imxood commented 3 years ago

It should be said that the $ symbol in the code block should not be parsed

here is some $ symbol in the code block, this is parsed wrongly!

image

image

lzanini commented 3 years ago

Oh I see. I should be able to fix this, I'll look into it

imxood commented 3 years ago

Oh I see. I should be able to fix this, I'll look into it

Also consider the $ symbol in the code block of tab indentation, which may be a bit difficult

thank you very much~

parazyd commented 2 years ago

Any luck fixing this @lzanini ?

SichangHe commented 1 year ago

Should have been fixed.

HadrienG2 commented 1 year ago

This is actually not fixed for `inline code blocks`.

SichangHe commented 1 year ago

I see. Let me see what I can do.

SichangHe commented 1 year ago

This should fix inline code blocks https://github.com/lzanini/mdbook-katex/commit/5efa3869aa4d84869325c42d836349ef1a7e53d4.

HadrienG2 commented 1 year ago

Thank you !

your-diary commented 12 months ago

It seems the problem still exists.

Markdown

1. hello

    <!-- ` -->

2. world

    `$object->{'id'}`

    ```php
    $object = $another

### `mdbook`

![Screenshot 2023-10-10 at 19 09 11](https://github.com/lzanini/mdbook-katex/assets/58146437/5c4406e1-aa7d-4c6d-9d1e-f2ba004d75de)

### GitHub

1. hello

    <!-- ` -->

2. world

    `$object->{'id'}`

    ```php
    $object = $another