web-infra-dev / mdx-rs Goto Github PK
View Code? Open in Web Editor NEWRust MDX compilation binding for Rspress
License: MIT License
Rust MDX compilation binding for Rspress
License: MIT License
Seems like the library is trying to load all the libraries regardless of the cpu architecture
Trying to load mdx-rs in next js api end points
./node_modules/@rspress/mdx-rs/index.js
Module not found: Can't resolve './mdx-binding-core.android-arm64.node' in '/Users/gsid/Work/projects/mdxify/node_modules/@rspress/mdx-rs'
Import trace for requested module:
./node_modules/@rspress/mdx-rs/index.js
./app/api/site/[siteId]/node/[nodeId]/route.ts
./node_modules/@rspress/mdx-rs/index.js
Module not found: Can't resolve '@rspress/mdx-rs-android-arm64' in '/Users/gsid/Work/projects/mdxify/node_modules/@rspress/mdx-rs'
Import trace for requested module:
./node_modules/@rspress/mdx-rs/index.js
./app/api/site/[siteId]/node/[nodeId]/route.ts
./node_modules/@rspress/mdx-rs/index.js
Module not found: Can't resolve './mdx-binding-core.android-arm-eabi.node' in '/Users/gsid/Work/projects/mdxify/node_modules/@rspress/mdx-rs'
....
showing this error.
import { compile } from './index.js';
const { toc } = await compile({
value: `# Title
## Foo {#my-anchor}
## Bar {Math.PI}
`,
filepath: 'README.mdx',
development: true,
root: '/root',
});
console.log(toc);
Expected toc should be:
[
{ text: 'Foo', id: 'my-anchor', depth: 2 },
{ text: 'Bar ', id: 'bar-', depth: 2 }
]
But got:
[
{ text: 'Foo', id: 'foo-', depth: 2 },
{ text: 'Bar ', id: 'bar-', depth: 2 }
]
Did a little dig into it, and found it caused by the parse options passed to markdown-rs
here:
mdx-rs/crates/mdx_rs/src/lib.rs
Lines 62 to 78 in 5b52c03
Specifically it is the option mdx_expression_text
inside Constructs::mdx()
. The parser would parse #my-anchor
as an javascript expression when this option is turned on.
Maybe we can give mdx_expression_parse
a custom function to handle this kind of special cases, but I haven't find a clean fix yet.
mdx-rs/crates/mdx_rs/src/lib.rs
Lines 132 to 133 in d5f454c
But there is jsx
field in the Options
struct:
mdx-rs/crates/mdx_rs/src/configuration.rs
Lines 184 to 188 in d5f454c
When there is a ' (apostrophe) in a heading the html out will generate
## WP Engine's Weekly Digest
will produce WP Engine\'s Weekly Digest
this is not happening when the ' is in a paragraph
Is there a way to pass custom components to the compile function to generated html includes the custom component?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.