Skip to content
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

Add rehype-mathml to list of plugins #186

Merged
merged 1 commit into from
Nov 15, 2024

Conversation

Daiji256
Copy link
Contributor

Initial checklist

  • I read the support docs
  • I read the contributing guide
  • I agree to follow the code of conduct
  • I searched issues and couldn’t find anything (or linked relevant results below)
  • If applicable, I’ve added docs and tests

Description of changes

Add rehype-mathml to list of plugins

Rendering math with MathML is lightweight and supported by many browsers.
I wanted a plugin for rendering math with MathML, similar to rehype-mathjax and rehype-katex, so I have created rehype-mathml.

npm: @daiji256/rehype-mathml

@github-actions github-actions bot added 👋 phase/new Post is being triaged automatically 🤞 phase/open Post is being triaged manually and removed 👋 phase/new Post is being triaged automatically labels Nov 15, 2024
@codecov-commenter
Copy link

codecov-commenter commented Nov 15, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (9bc5528) to head (97080f9).
Report is 21 commits behind head on main.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #186   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            6         6           
  Lines          154       163    +9     
=========================================
+ Hits           154       163    +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@wooorm
Copy link
Member

wooorm commented Nov 15, 2024

Nice!

  • a stable 1.0.0 release might be nice before adding it to this list
  • readme could use more mentions/links of temml, the core library that does the work, whose options are supported — as a user looking through different math packages, I’d be interested in that!
  • instead of the result = unified()….parse(mathml).children code, I strongly recommend https://github.com/syntax-tree/hast-util-from-html-isomorphic! It’s lighter especially in browsers, it’s a simpler API call, and it drops positional info (which are now incorrect)

@Daiji256
Copy link
Contributor Author

Thank you for your comments.

a stable 1.0.0 release might be nice before adding it to this list

Based on the advice given in this pull request, I was planning to make some adjustments and then release stable 1.0.0. Is it necessary to release stable 1.0.0 immediately?

readme could use more mentions/links of temml, the core library that does the work, whose options are supported — as a user looking through different math packages, I’d be interested in that!

Do I need to describe the reasons for using temml? Or do I need to add the main options of temml to the README? Links to temml's options have already been included.

instead of the result = unified()….parse(mathml).children code, I strongly recommend https://github.com/syntax-tree/hast-util-from-html-isomorphic! It’s lighter especially in browsers, it’s a simpler API call, and it drops positional info (which are now incorrect)

I wasn't aware of hast-util-from-html-isomorphic. I will make the necessary corrections.

@wooorm
Copy link
Member

wooorm commented Nov 15, 2024

Is it necessary to release stable 1.0.0 immediately?

No — but: this list is for recommended things; that conflicts with software in beta

Do I need to describe the reasons for using temml? Or do I need to add the main options of temml to the README?

I was missing the first, yes, reasons to use this package over rehype-mathjax or rehype-katex. And that mostly has to do with temml!

@Daiji256
Copy link
Contributor Author

I have also completed the fix for hast-util-from-html-isomorphic, and after determining that the main code is sufficient, I have released stable 1.0.0.

As you pointed out, the README lacked descriptions of the strengths of this plugin, which uses MathML, and the reasons for using temml, making it unclear. I have added those details.

@wooorm wooorm merged commit f3b1a23 into rehypejs:main Nov 15, 2024
3 checks passed
@wooorm wooorm added 📚 area/docs This affects documentation 💪 phase/solved Post is done labels Nov 15, 2024
@wooorm
Copy link
Member

wooorm commented Nov 15, 2024

Thanks!

This comment has been minimized.

@github-actions github-actions bot removed the 🤞 phase/open Post is being triaged manually label Nov 15, 2024
@ChristianMurphy
Copy link
Member

Thanks @Daiji256! 👋
Some other suggestions:

  1. it doesn't look like the typescript types are published as part of 1.0.0, you may want to include those on npm https://www.npmjs.com/package/@daiji256/rehype-mathml
  2. where possible use a wider minimum version in version ranges, to allow package managers to deduplicate if they already require a lower version (e.g. "unified": "^11.0.5",) https://github.com/Daiji256/rehype-mathml/blob/9cd35ed4ea3e8f734a22f068fc003553d3cdd93d/package.json#L37-L41
  3. ESInterop is not required and should be avoided in node16 module mode https://github.com/Daiji256/rehype-mathml/blob/9cd35ed4ea3e8f734a22f068fc003553d3cdd93d/tsconfig.json#L7
  4. The dependencies for this module should in theory also have valid types, and don't need to be skipped https://github.com/Daiji256/rehype-mathml/blob/9cd35ed4ea3e8f734a22f068fc003553d3cdd93d/tsconfig.json#L9
  5. The types hast dependency appears in the code but not in the dependencies, you may want to declare it a dependency so yarn and pnpm work https://github.com/Daiji256/rehype-mathml/blob/9cd35ed4ea3e8f734a22f068fc003553d3cdd93d/lib/index.ts#L1

@Daiji256
Copy link
Contributor Author

@ChristianMurphy
Thank you for the suggestions! I’ll review them and make the necessary updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📚 area/docs This affects documentation 💪 phase/solved Post is done
Development

Successfully merging this pull request may close these issues.

4 participants