question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Enhancement: Support Creation of "new" .mdx content items

See original GitHub issue

Is your feature request related to a problem? Please describe. As someone who exclusively uses MDX for content creation (as well as FrontMatter) I’m frustrated when creating new content because I need to change the file extension manually to support my workflow-- despite the plugin generally supporting FrontMatter in MDX files.

Describe the solution you’d like In ArticleHelper, the createContent method hard-codedly decides that the file extension should be “.md”. Similarly, this happens in template generation as well.

I’d propose this be determined via a frontmatter setting.

Describe alternatives you’ve considered

  • Manually changing the file extension on my own every time I create new content (not preferred)
  • Creating a field to the content type template definitions in frontMatter.taxonomy.contentTypes per @zivbk1 here.
  • Respecting the file extension for template files per @zivbk1 here

Additional context I would anticipate a change like this would be fully backwards compatible, as the default extension should remain “.md”.

I’m happy to open a PR to address this once there’s some buy-in.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
farmeraucommented, Jan 3, 2022

@zivbk1 I agree that these are also great alternatives. Updated description.

1reaction
estruyfcommented, Jan 4, 2022

@farmerau I have added better mdx support for content creation. Things that changed:

  • When creating content from a template, it will use the file extension of the template.
  • When creating content for a content type, it will use the defined file type md | mdx. This is a new property (optional) on the frontMatter.taxonomy.contentTypes setting called fileType.
  • When creating content for a content type, it will check if it has a defined file type, if not, it uses the new frontMatter.content.defaultFileType setting for the file type to create. This setting is by default set to md, but if you change it to mdx, all new content will be created as mdx files. The benefit of this setting is that you only need to specify it once, and all content types will use it.

This is now available in the beta version. Feel free to give it a try, and let me know how it works for you. Beta version can be found here: https://marketplace.visualstudio.com/items?itemName=eliostruyf.vscode-front-matter-beta

Info: In order to use the beta, you have to uninstall the main version. Nothing will be lost, it is just a limitation of VS Code.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting started
Once everything is set up in your project, you can enhance the experience by adding support for MDX in your editor:.
Read more >
How to Source MDX Content in Next.js to Dynamically ...
Step 0: Creating a new Next.js app with Create Next app; Step 1: Adding new blog posts with MDX; Step 2: Using Next...
Read more >
hashicorp/next-mdx-enhanced: A Next.js plugin that ...
A Next.js plugin that enables MDX pages, layouts, and front matter ... for site search or any other purpose where you'd like to...
Read more >
Build a MDX-powered blog with Contentlayer and Next
A simple way of creating a static Markdown-based blog site.
Read more >
An Introduction to MDXJS
The playground supports MDX natively to create pages that serve both as demo and documentation, which is super ideal for demonstrating React ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found