Skip to content

Conversation

@krisjdev
Copy link
Contributor

Ref TinyTapeout/tinytapeout-gf-0p2#90

This PR adds support for rendering math using the tex dollar syntax ($$..$$ and $..$) in the project documentation on the website. This brings it more in-line with the shuttle datasheet, as it uses the tex dollar syntax too.

Using the project above as an example with the new changes:
image

I had originally mentioned markdown-it-dollarmath, but that package hasn't been updated for the node version being used, so I had to switch to markdown-it-texmath.

I've marked this as a draft PR for now since there's some points I want to address:

  1. @urish mentioned that I should double check that malicious HTML can't be inserted, and I've tried to mitigate that with the throwOnError, strict and trust options for katex (docs), but I feel like that isn't sufficient - do you know of any resources for better testing?
  2. Related to (1), would it be worthwhile to implement DOMPurify?
  3. Somewhat related to (1), but is there a better way of testing the website while modifying user content? I resorted to hosting my own index server and had to patch the address it fetched the details from...

This is a best-guess limit, since the default for `katex`is `Infinity`, meaning the user could make arbitrarily large elements and spaces. This hopefully will strike a good balance between what the user can do and what's appropriate for the website.
shuttleMapSvg,
}: IProjectPropProps) {
const md = MarkdownIt();
const md = MarkdownIt().use(require('markdown-it-texmath'), {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is using require('markdown-it-texmath') correct here? I tried using import but it wasn't auto-completing - I'm assuming I'm missing some type files for it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant