Code Monkey home page Code Monkey logo

mdx-rs's People

Contributors

10derozan avatar chenjiahan avatar cijiugechu avatar sanyuan0704 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mdx-rs's Issues

confusion of readme

image
image
光从readme看,一开始不明白那个参数value里的content是怎么来的,看了test case才明白。

个人小建议

Using mdx-rs with nextjs

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.

Custom anchor id not get extracted into toc in .mdx file

Reproduction

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 }
]

More information

Did a little dig into it, and found it caused by the parse options passed to markdown-rs here:

let parse_options = ParseOptions {
constructs: Constructs {
frontmatter: true,
// Enable GFM Grammer
gfm_autolink_literal: true,
gfm_label_start_footnote: true,
gfm_footnote_definition: true,
gfm_strikethrough: true,
gfm_table: true,
gfm_task_list_item: true,
// If is_mdx is true, use mdx constructs, or use markdown constructs
..if is_mdx {
Constructs::mdx()
} else {
Constructs::default()
}
},

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.

A backslash \' is added for an apostrophe

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.