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

consult how to use token like js markdown-it in markdown-it-rust #42

Open
Maidang1 opened this issue Jul 28, 2024 · 1 comment
Open

Comments

@Maidang1
Copy link

The project is really awesome! I'm going to implement @mdit-vue/plugin-component into Rust. When I checked the source code of @mdit-vue/plugin-component, I found some code as follows.
https://github.com/mdit-vue/mdit-vue/blob/main/packages/plugin-component/src/html-block-rule.ts#L111

   let token = state.push('html_inline', '', 0);
   token.content = match[0];
   token.map = [startLine, state.line];
   // treat the following content as `inline` token to be parsed by other inline rules
   token = state.push('inline', '', 0);
   token.content = lineText.slice(match[0].length);
   token.map = [startLine, state.line];
   token.children = [];

I'm confused about how to use the token in markdown-it-rust. Could you please give me a hand?

@Maidang1
Copy link
Author

Maybe I'm misrepresenting what I mean. I want to return two Node in an BlockRule run function like the code above. I just found return Some(Node, XX) is just push one Node into the state.node. So I have no idea how to implement same function。

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

No branches or pull requests

1 participant