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

Include default set of remark plugins #295

Closed
4 tasks done
remcohaszing opened this issue Feb 3, 2023 · 8 comments · Fixed by #340
Closed
4 tasks done

Include default set of remark plugins #295

remcohaszing opened this issue Feb 3, 2023 · 8 comments · Fixed by #340
Labels
💪 phase/solved Post is done

Comments

@remcohaszing
Copy link
Member

Initial checklist

Problem

Currently remark plugins need to be specified explicitly in order to use them. However, many users might not configure the mdx section in tsconfig.json. They might not even use tsconfig.json at all.

Solution

Provide remark-frontmatter and remark-gfm by default, unless plugins are explicitly specified.

This behaviour is similar to TypeScript. By default the language service supports a large set of the builtin library and loose options, but as soon as the user configures TypeScript properly, this config takes over.

Alternatives

I think remark-frontmatter and remark-gfm are the most commonly used, and provide nice defaults. The exact plugin list is up for discussion, or could even change over time.

@wooorm
Copy link
Member

wooorm commented Feb 3, 2023

yep sounds good!

@adueck adueck mentioned this issue Feb 4, 2023
4 tasks
@adueck
Copy link

adueck commented Feb 4, 2023

Perhaps also remark-mdx-frontmatter along with remark-frontmatter which exports the frontmatter variables, although I don't know how standard practice it is to have the frontmatter variables exported.

---
title: My Post
---

The title is {title}

@remcohaszing
Copy link
Member Author

Thanks for the input!

remark-mdx-frontmatter only provides a transformer, not a parser plugin. Currently we only support parser plugins. I created an issue for this (#297). This argument doesn’t exclude it from being added later.

I agree remark-mdx-frontmatter is a good candidate by just looking at its popularity. However, the different popular values for the name option make the defaults to use for IntelliSense ambiguous. I.e. pretty common are { name: 'meta' } and { name: 'frontmatter' }. For this reason I believe it’s better not to add it.

@wooorm
Copy link
Member

wooorm commented Feb 4, 2023

You could maybe make the default frontmatter (I still think exposing as a single name always is best). And document here and there that that’s what’s recommended, and if someone picks something else, that’s on them?

@adueck
Copy link

adueck commented Feb 4, 2023

Ya I agree it's probably less necessary/useful to have remark-mdx-frontmatter. After years of dealing with lots of mdx content I can't tell you guys how thankful I am to see this stuff being worked on! 🙇‍♂️

@remcohaszing
Copy link
Member Author

I'm also inclined to believe it's the right approach to pick a default name (frontmatter seems right), and remove support for keys as export names in remark-mdx-frontmatter in a next major version. Still, for it to work here, transformers need to he supported. I agree it's nice to include it by default once those requirements are met.

remcohaszing added a commit that referenced this issue Aug 18, 2023
- Volar handles the mapping between TypeScript and LSP.
- Volar handles the mapping between TypeScript and Monaco editor.
- Volar manages virtual files.
- Volar imports TypeScript directly. As a result, the Monaco editor
  integration now requires `path` to be polyfilled.
- It is no longer possible to pass compiler options in the Monaco editor
  integration.
- This adds editor features for YAML based on `yaml-language-server`.
  This has been contributed upstream to Volar and is pending review.
- Markdown features are now handled by
  `vscode-markdown-languageservice`. This will be contributed upstream
  to Volar soon.
- Markdown definitions are broken due to a bug in Volar.
- This adds `remark-frontmatter` with TOML and YAML support as well as
  `remark-gfm` by default unless specified otherwise in `tsconfig.json`.
- The language server now requires `typescript.tsdk` to be passed via
  initialization options.
- This adds support for debugging virtual documents using Volar labs.

Closes #168
Closes #284
Closes #295
Closes #298
Closes #301
remcohaszing added a commit that referenced this issue Oct 23, 2023
- Volar handles the mapping between TypeScript and LSP.
- Volar handles the mapping between TypeScript and Monaco editor.
- Volar manages virtual files.
- Volar imports TypeScript directly. As a result, the Monaco editor integration now requires `path` to be polyfilled.
- `@mdx-js/monaco` is deprecated and removed.
- This adds `remark-frontmatter` with TOML and YAML support as well as `remark-gfm` by default unless specified otherwise in `tsconfig.json`.
- The language server now requires `typescript.tsdk` to be passed via initialization options.
- This adds support for debugging virtual documents using Volar labs.

Closes #168
Closes #284
Closes #295
Closes #298
Closes #301

Co-authored-by: Christian Murphy <christian.murphy.42@gmail.com>
Co-authored-by: Johnson Chu <johnsoncodehk@gmail.com>
@remcohaszing
Copy link
Member Author

Released in vscode-mdx@1.5.0, @mdx-js/language-server@0.2.0 🎉

@wooorm wooorm added the 💪 phase/solved Post is done label Nov 9, 2023
@JounQin
Copy link
Member

JounQin commented Nov 10, 2023

@remcohaszing I think .remarkrc should be supported at the same time?

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

Successfully merging a pull request may close this issue.

4 participants