question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support math syntax (latex/katex/etc)

See original GitHub issue

I would like to have math in markdown, for this reason I’m using the configurations reported at the bottom.

Nevertheless math is not rendering in markdown neither enclosed in $ (or double $$), nor explicitly annotated in html, e.g.:

Lift($L$) can be determined by Lift Coefficient ($C_L$) like the following
equation.

<div class="math math-display">
  L = \frac{1}{2} \rho v^2 S C_L
</div>

it is rendered literally, without any transformation.

Is this related to #206? Will it be solved, sooner or later? (otherwise I have to consider dropping mdsvex)


// mdsvex.config.js
import remarkMath from 'remark-math';
import rehypeKatex from 'rehype-katex';

export default {
  extensions: [".svx", ".md"],
  remarkPlugins: [
    remarkMath,
  ],
  rehypePlugins: [
    rehypeKatex,
  ],
};
// svelte.config.js
import adapter from '@sveltejs/adapter-static';
import preprocess from 'svelte-preprocess';
import { mdsvex } from 'mdsvex';
import mdsvexConfig from "./mdsvex.config.js";

const config = {
  preprocess: [
    mdsvex(mdsvexConfig),
    preprocess()
  ],

  extensions: ['.svelte', '.md', '.svx'],

  kit: {
    adapter: adapter(),
    target: '#svelte'
  }
};

export default config;

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:3
  • Comments:19 (6 by maintainers)

github_iconTop GitHub Comments

5reactions
pngwncommented, Sep 12, 2021

Maybe I’ll sort something out one day 😄

Glad this is all working for you

I think I’ll keep this open but I’ll change the title to be about supporting math syntax, it will help me to track it for v1.

4reactions
kwshicommented, Feb 16, 2022

Hi y’all, just wanted to plug a package I wrote to deal with these issues while trying to use mdsvex for my own website: https://github.com/kwshi/rehype-katex-svelte

It’s essentially a drop-in replacement for rehype-katex, so it allows $ and $$ syntax, but it resolves the issue of Svelte choking on curly-braces by wrapping things in an {@html "..."} node. Would appreciate it if you try it out and let me know if it helps!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Supported Functions - KaTeX
This is a list of TeX functions supported by KaTeX. It is sorted into logical groups.
Read more >
LaTeX/Mathematics - Wikibooks, open books for an open world
Typesetting mathematics is one of LaTeX's greatest strengths. It is also a large topic due to the existence of so much mathematical notation....
Read more >
Remove everything that is in math mode - TeX
There are a few very different ways to enter and to exit math mode: TeX math shift character, catcode 3, typically $; LaTeX...
Read more >
Mathematical expressions - Overleaf, Online LaTeX Editor
This article shows the most basic commands needed to get started with writing maths using LaTeX. Writing basic equations in LaTeX is straightforward, ......
Read more >
The KatePart Handbook - KDE Documentation -
3 Working with the KatePart editor. 12. 3.1 Overview . ... 6.2.2 The KatePart Syntax Highlight System . ... in ECMAScript, the LATEX...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found