mirror of
https://github.com/progsource/maddy.git
synced 2026-03-24 23:40:39 +01:00
feat: add optional latex block support
This commit is contained in:
@@ -376,3 +376,29 @@ becomes
|
||||
</table>
|
||||
```
|
||||
table header and footer are optional
|
||||
|
||||
## LaTeX(MathJax) block support
|
||||
|
||||
To turn on the LaTeX support - which basically is only a
|
||||
[MathJax](https://www.mathjax.org/) support and makes sure, that formulas aren't
|
||||
internally checked for other parsers - it has to be enabled in config:
|
||||
|
||||
```cpp
|
||||
std::shared_ptr<maddy::ParserConfig> config = std::make_shared<maddy::ParserConfig>();
|
||||
config->enabledParsers |= maddy::types::LATEX_BLOCK_PARSER;
|
||||
|
||||
std::shared_ptr<maddy::Parser> parser = std::make_shared<maddy::Parser>(config);
|
||||
std::string htmlOutput = parser->Parse(markdownInput);
|
||||
```
|
||||
|
||||
After this you can do the following in Markdown:
|
||||
|
||||
```
|
||||
$$x = {-b \\pm \\sqrt{b^2-4ac} \\over 2a}.$$
|
||||
```
|
||||
|
||||
Which results in
|
||||
|
||||
```html
|
||||
$$x = {-b \\pm \\sqrt{b^2-4ac} \\over 2a}.$$\n
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user