-
-
Notifications
You must be signed in to change notification settings - Fork 176
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
v8 discussion thread #485
Comments
For the next iteration, I suggest |
Great idea |
Is there a suggested way to parse newlines? edit: is it this? https://github.com/probablyup/markdown-to-jsx#optionswrapper edit2: Had to replace singular \n with \n\n |
Hello, Thanks for the great library. |
Thanks for the library :) I would very much love #480 latex parsing |
Thinking about how to support this! Will try to land it in the current version |
LaTeX support has been enabled in v7.4 with any compatible library, thanks! https://github.com/quantizor/markdown-to-jsx/releases/tag/v7.4.0 import TeX from '@matejmazur/react-katex'
import { Markdown, RuleType } from 'markdown-to-jsx'
const exampleContent =
'Some important formula:\n\n```latex\nmathbb{N} = { a in mathbb{Z} : a > 0 }\n```\n'
function App() {
return (
<Markdown
children={exampleContent}
options={{
renderRule(next, node, renderChildren, state) {
if (node.type === RuleType.codeBlock && node.lang === 'latex') {
return (
<TeX as="div" key={state.key}>{String.raw`${node.text}`}</TeX>
)
}
return next()
},
}}
/>
)
} |
Great to see this happening! One more thing: inline Latex is the last blocking issue for us to move to markdown-to-jsx. In our scenario, we use inline latex heavily for math formula. For example: This is display math mode while this The source code is shown below:
Please shed light on this, thanks in advance. |
You could use the overrides feature and look for relevant syntax in the code element. |
@quantizor Thanks for this library! I was wondering if you'd consider exposing it in a modular fashion, so that it's very tree-shakeable and allows people to pick which parts of the markdown spec they wish to support. For example, there's still full support if required, but instead of opt-out: import Markdown from "markdown-to-jsx"
<Markdown
options={{
overrides: {
del: ({ children }) => children,
},
}}
>
{text}
</Markdown> It's opt-in: import { bold, italic, link, compose } from "markdown-to-jsx"
const Markdown = compose(bold, italic, link)
<Markdown>{content}</Markdown> Our use case for this is for support within a component library, where we want to support a very limited amount of markdown syntax. |
@will-stone it's definitely on my radar |
For the next major version of the library, I want to focus on is drastically improving perf throughput and eliminating sources of catastrophic backtracking in the many regexes that make up core.
Ideas and RFCs are welcome. Note that the point of the library is still to stay very small (under 5kB if possible.)
The text was updated successfully, but these errors were encountered: