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

Markdown prevails on Katex when parsing a formula #633

Closed
Azkellas opened this issue Aug 24, 2023 · 2 comments
Closed

Markdown prevails on Katex when parsing a formula #633

Azkellas opened this issue Aug 24, 2023 · 2 comments
Labels
bug Something isn't working stale This issue or pull request has not had any recent activity

Comments

@Azkellas
Copy link

Issue description

Issue description

When using katex to write math formulaes, it is first processed in markdown then in katex, resulting in many broken formulaes without any feedback from katex, as it didn't understand it was supposed to be its.

Minimum reproducible examples

$$

$$

The newline creates two empty paragraphs, instead of a katex block in a single paragraph.

$$ {a}\_1 + a\_{1} $$

The _ are not escaped, resulting in emphasis in markdown, instead of subscripts for katex.

$$
f(x) = x
* y
* z
$$

The * create a list in markdown, instead of a multiplication in katex.

...and so on.

Possible solution

For my website, I wrote two simple shortcodes to solve the issue:

<!-- texblock -->
$${{.Inner}}$$

and

<!-- texline -->
\({{.Inner}}\)

Then in markdown files, I first use {{< katex >}} to include katex, then either {{< texblock >}} or {{< texline >}} to write formulaes.

I'm new to hugo and congo, so this might not be the best solution or most elegant one (is it possible to automatically include katex if any tex shortcode is found?), but it does the job. I'm more than willing to do a PR if you want.

Note: bug previously mentioned in #586

Theme version

v2.6.1

Hugo version

v0.117.0

Which browser rendering engines are you seeing the problem on?

Chromium (Google Chrome, Microsoft Edge, Brave, Vivaldi, Opera, etc.), Firefox (Mozilla Firefox)

URL to sample repository or website

No response

Hugo output or build error messages

No response

@Azkellas
Copy link
Author

So after a quick look at congo's codebase, I went ahead and made the PR, as it was simple enough for me to have a go. :)

Copy link

This issue has been automatically marked as stale because it has not had any recent activity.
If you are still experiencing this issue, please review the issue history and add a reply with any requested and/or additional information in order to keep the issue open.
This issue will automatically close in 30 days if no further activity occurs.

@github-actions github-actions bot added the stale This issue or pull request has not had any recent activity label Dec 23, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale This issue or pull request has not had any recent activity
Projects
None yet
Development

No branches or pull requests

1 participant