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

Ability to ignore specific code similar to @ts-ignore #10

Closed
4 tasks done
KamilDev opened this issue Dec 24, 2024 · 3 comments
Closed
4 tasks done

Ability to ignore specific code similar to @ts-ignore #10

KamilDev opened this issue Dec 24, 2024 · 3 comments
Labels
🙅 no/wontfix This is not (enough of) an issue for this project 👎 phase/no Post cannot or will not be acted on

Comments

@KamilDev
Copy link

Initial checklist

Problem

When using a templating language inside MDX, you will get the following error:

{% include "api-docs-table.liquid", apiDoc: "apiDocs.converter" %}

Could not parse expression with acornMDX (micromark-extension-mdx-expression:acorn)

Current solutions

I have not found any current way to ignore the error.

Proposed solutions

It would be great to be able to ignore expected errors, for example similar to @ts-ignore:

{ /* @mdx-ignore */ }
{% include "api-docs-table.liquid", apiDoc: "apiDocs.converter" %}
@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 Dec 24, 2024
@ChristianMurphy
Copy link
Member

ChristianMurphy commented Dec 24, 2024

Welcome @KamilDev! 👋
Thanks for sharing your idea.

Remark/MDX has a way to support syntax extensions, including the one you describe, see https://github.com/micromark/micromark?tab=readme-ov-file#extending-markdown and https://github.com/micromark/micromark?tab=readme-ov-file#creating-a-micromark-extension (define what valid syntax is)

And has a way to disable lint rules https://github.com/remarkjs/remark-lint/tree/main?tab=readme-ov-file#ignore-warnings (check control flow and styling of valid syntax)

What you want is a loose mode (with a flag) for MDX, which fundamentally conflicts with the language goal.
MDX is Markdown + JSX, JSX is is JS + XML.
Neither JavaScript nor XML allow invalid syntax to exist within a document.

If you need a more forgiving parser.
Use markdown, there is no such thing as an invalid document in plain markdown.

There will not be a loose mode in core MDX.


To address your need which is implied through this.
You want to be able to import external documents.
MDX supports this, it is one of the core language features, imports https://mdxjs.com/docs/what-is-mdx/#esm
This means you can import and embed MDX document inside of others.

Additionally, when paired with a build tool/bundler it can import any file/document type that the build tool supports.
For example an external handlebars template with rollup as the build tool https://github.com/mixmaxhq/rollup-plugin-handlebars-plus

If you want to use MDX, use it, don't make up another language.

@ChristianMurphy ChristianMurphy closed this as not planned Won't fix, can't repro, duplicate, stale Dec 24, 2024
@ChristianMurphy ChristianMurphy added the 🙅 no/wontfix This is not (enough of) an issue for this project label Dec 24, 2024

This comment has been minimized.

@github-actions github-actions bot added 👎 phase/no Post cannot or will not be acted on and removed 🤞 phase/open Post is being triaged manually labels Dec 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🙅 no/wontfix This is not (enough of) an issue for this project 👎 phase/no Post cannot or will not be acted on
Development

No branches or pull requests

3 participants