vscode-mdc icon indicating copy to clipboard operation
vscode-mdc copied to clipboard

Usage with Monaco?

Open CapitaineToinon opened this issue 1 year ago • 6 comments

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 !

CapitaineToinon avatar May 29 '24 10:05 CapitaineToinon

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

atinux avatar May 29 '24 15:05 atinux

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.

CapitaineToinon avatar Jun 10 '24 09:06 CapitaineToinon

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.

farnabaz avatar Jun 11 '24 08:06 farnabaz

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 avatar Jun 11 '24 09:06 CapitaineToinon

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

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

CapitaineToinon avatar Jun 11 '24 09:06 CapitaineToinon

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

farnabaz avatar Jun 11 '24 09:06 farnabaz

@farnabaz any plan to open source the monarch-mdc repo? I'm trying to figure out if I can support a formatting extension for monaco specifically for MDC

adamdehaven avatar Dec 03 '24 15:12 adamdehaven

I am open to open source it if you want to make it public @farnabaz

atinux avatar Dec 10 '24 16:12 atinux

The source is now available: https://github.com/nuxtlabs/monarch-mdc

farnabaz avatar Dec 16 '24 12:12 farnabaz

I had a local version working but I much prefer to use this.

Thanks again @farnabaz 🚀 !

adamdehaven avatar Dec 17 '24 01:12 adamdehaven