quartz-research-note/quartz
Hrishikesh Barman 2f99339dcf
feat: add transformations for latex in oxhugofm (#510)
ox-hugo currently supports the following syntax for latex equations:
- https://orgmode.org/manual/LaTeX-fragments.html
- https://ox-hugo.scripter.co/doc/equations

This syntax is supported by mathjax as is mentioned in the ox-hugo documentation.

But quartz uses remark-math which has some issues with the \( \) syntax.
See https://github.com/remarkjs/remark-math/issues/39

This change adds few more transformations to the OxHugoFlavouredMarkdown
plugin, which makes a best effort conversion of this syntax into what
the Quartz Latex transformer plugin supports.

With these changes, the generated files show latex formatting with
default quartz configuration.

Sidenote on `\_` escape by ox-hugo:

ox-hugo escapes, _ using \_, we match against it after we transform
equations into what quartz supports($$ and $).

This could be achieved using lookaround like regex as follows
```js
(?<=(\$|\$\$)[\s\S]*) -> Positive lookbehind for $ or $$
\\_ -> Matches \_
(?=[\s\S]*(?:\1)) Positive lookahead for $ or $$ if matched
const escapedUnderscoreRegex = new RegExp(/(?<=(\$|\$\$)[\s\S]*)\\_(?=[\s\S]*(?:\1))/, "g")
````

But since lookahead/behind can slow things down on large files, we just
look up all equations with $ and $$ delimiters and then try replacing \_
2023-09-29 11:35:26 -07:00
..
cli feat: support configurable ws port and remote development (#429) 2023-08-27 17:39:42 -07:00
components feat: Better and more responsive tag behavior (#515) 2023-09-29 11:17:48 -07:00
plugins feat: add transformations for latex in oxhugofm (#510) 2023-09-29 11:35:26 -07:00
processors fix relative path resolution in router and link crawling 2023-08-16 22:04:15 -07:00
static Revert "feat: Making Quartz available offline by making it a PWA (#465)" 2023-09-20 13:52:45 -07:00
styles fix: mermaid copy source position 2023-09-24 10:31:54 -07:00
util feat: implement breadcrumb component (#508) 2023-09-29 10:26:15 +02:00
bootstrap-cli.mjs cleanup: rework cli to allow invoking create and build outside of cli (#428) 2023-08-27 15:59:51 -07:00
bootstrap-worker.mjs run prettier 2023-07-22 17:27:41 -07:00
build.ts fix: links to index not showing in graph (closes #450) 2023-09-06 22:24:15 -07:00
cfg.ts Revert "feat: Making Quartz available offline by making it a PWA (#465)" 2023-09-20 13:52:45 -07:00
worker.ts base path refactor to better support subpath hosting 2023-08-19 15:52:25 -07:00