Skip to content

Add .mdx extension support - #3438

Merged
Jocs merged 1 commit into
marktext:developfrom
davidknezic:mdx-support
Aug 3, 2023
Merged

Jocs merged 1 commit into
marktext:developfrom
davidknezic:mdx-support

Conversation

@davidknezic

Copy link
Copy Markdown
Contributor
Q A
Bug fix? no
New feature? yes
Breaking changes? no
Deprecations? no
New tests added? not needed
Fixed tickets Fixes #2109
License MIT

Description

Make it possible to open .mdx files which are Markdown files with the possibility of adding JavaScript (JSX) code. MDX is already very widespread and is still gaining a lot of popularity.

The main effect this change has is that it displays files with the .mdx ending in the sidebar and allows them to be opened.

image

As the files are basically Markdown files, they are already displayed correctly. Any JSX inside of the files also already looks good and doesn't need any special treatment:

image

Saving works perfectly fine.

This PR conflicts with and closes #3424 that was opened recently. It adds the MDX extension to a couple more places in the source code / docs.

@pythonicode

Copy link
Copy Markdown

Would be nice to get a reviewer here. This is pretty important for developers using React and MDX

@Jocs
Jocs merged commit 453cf9d into marktext:develop Aug 3, 2023
@AdrianoCahete

Copy link
Copy Markdown

@Jocs the latest build has this feature?

@Jocs

Jocs commented Nov 1, 2023

Copy link
Copy Markdown
Member

@AdrianoCahete I have not release the new version with this feature yet.

@abdulhakim-alshanqiti

Copy link
Copy Markdown

I am currently using https://markdoc.dev/ its trying to achive the same effect as mdx but with much better performance and flexability

basic example:

This is shown no matter what.

{% if $myFunVar %}
Only appear if $myFunVar!
{% /if %}

also you can do what mdx dose but with better experince for authors and devolopers by seperating your code from your content while also providing small components that the authors can use

@fazi-gondal

Copy link
Copy Markdown

Please make support for mdx file

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

Successfully merging this pull request may close these issues.

Support or at least let open .mdx?

6 participants