nuxtlabs / vscode-mdc

Provides syntax highlighting and colon matching for MDC (Markdown Components) files for Nuxt Content.
https://marketplace.visualstudio.com/items?itemName=Nuxt.mdc
MIT License
69 stars 2 forks source link

Usage with Monaco? #37

Closed CapitaineToinon closed 1 week ago

CapitaineToinon commented 4 months ago

Hello !

I've been looking at various markdown supersets and how to integrate them on a website through editors such as the monaco editor. As far as I understand, while monaco powers vscode under the hood, it's not possible to directly use such an extension with monaco. I'd love some direction if I'm wrong on that point though.

Allowing for this would be incredibly powerful in my opinion. Being able to store MDC content in a database and edit it through an admin dashboard would be great.

This project doesn't have discussions open so I'm opening a ticket instead, sorry about that.

Thanks for the help !

atinux commented 4 months ago

I believe @farnabaz made it work inside an embedded Monaco Editor

CapitaineToinon commented 3 months ago

I felt down quite the rabbit hole looking into this. Apparently vscode supports text-mate configuration files out of the box but monaco does not. Seems to be possible to load those anyway using some wasm regex library but all the examples are old and not maintained. If someone has an example up and running, I would love to be able to take a look.

farnabaz commented 3 months ago

Hey @CapitaineToinon, Sadly, monaco does not support text-mate languages, instead it has its own way that called monarch.

You can use nuxtlabs/monarch-mdc to allow highlighting MDC in monaco.

CapitaineToinon commented 3 months ago

Yeah I figured, although projects like https://github.com/bolinfest/monaco-tm managed to get it working apprently. Microsoft has a vscode-oniguruma package with a compiled wasm build that can be imported to then use vscode-textmate directly with monaco but everything being just not documented I couldn't get it to work.

It's great if there is a monarch version though! I assumed such a package existed as I used nuxthub for a while. However that package is private? That like gives me a 404.

CapitaineToinon commented 3 months ago

Oh okay seems to be accessible through npm and installs just fine. Thanks, will try that!

https://www.npmjs.com/package/@nuxtlabs/monarch-mdc

farnabaz commented 3 months ago

Yeah, may bad. It is not yet public, you can use it directly from npm https://www.npmjs.com/package/@nuxtlabs/monarch-mdc