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

[Question] How to use mdx parser on .md files? #214

Closed
kud opened this issue May 10, 2020 · 5 comments
Closed

[Question] How to use mdx parser on .md files? #214

kud opened this issue May 10, 2020 · 5 comments
Assignees

Comments

@kud
Copy link

kud commented May 10, 2020

Hello,

I've got a question. For some reasons (I explained here:http://diary.kud.io/en/posts/2020/05/10/how-to-edit-a-markdown-in-2020-part-1-zmv) I had to switch my mdx files from .mdx to .md.

However, when I use JsPrettier, it uses the markdown parser instead of mdx one (which is normal). Is there a way to always use mdx parser for markdown files?

Thank you.

@jonlabelle
Copy link
Owner

Hi @kud: Have you tried a configuration override?

@kud
Copy link
Author

kud commented May 11, 2020

Interesting option! I didn't know about that, I was searching into your options, not the one in prettier.

However, it doesn't work as you can see:

[debug] normalized argv: {"_":[],"color":true,"editorconfig":true,"use-tabs":false,"config":"/Users/kud/Projects/_kud/diary/.prettierrc.js","parser":"markdown","stdin-filepath":"/Users/kud/Projects/_kud/diary/src/pages/en/posts/2020/05/10/how-to-edit-a-markdown-in-2020-part-1-zmv/index.md","loglevel":"debug","cursor-offset":169,"plugin-search-dir":[],"plugin":[],"ignore-path":".prettierignore","debug-repeat":0,"config-precedence":"cli-override"}
[debug] load config file from '/Users/kud/Projects/_kud/diary/.prettierrc.js'
[debug] loaded options `{"parser":"mdx"}`
[debug] applied config-precedence (cli-override): {"filepath":"/Users/kud/Projects/_kud/diary/src/pages/en/posts/2020/05/10/how-to-edit-a-markdown-in-2020-part-1-zmv/index.md","cursorOffset":169,"parser":"markdown","useTabs":false}

Prettier process finished with exit code 0.
module.exports = {
  "overrides": [
    {
      "files": "*.md",
      "options": {
        "parser": "mdx"
      }
    }
  ]
}

even if mdx is read in the config, it's markdown used as parser. I don't know why.

@jonlabelle
Copy link
Owner

jonlabelle commented May 11, 2020

Add this to your JsPrettier.sublime-settings:

"additional_cli_args": { "--config-precedence": "file-override" }

@kud
Copy link
Author

kud commented May 12, 2020

Perfect! it works. Thank you very much. :)

@kud kud closed this as completed May 13, 2020
@github-actions
Copy link

This issue has been automatically locked due to inactivity. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants