Skip to content

feat: add vite devtools integration with playground#102

Open
arashsheyda wants to merge 7 commits intocomarkdown:mainfrom
arashsheyda:feat/vite-devtools
Open

feat: add vite devtools integration with playground#102
arashsheyda wants to merge 7 commits intocomarkdown:mainfrom
arashsheyda:feat/vite-devtools

Conversation

@arashsheyda
Copy link
Copy Markdown
Contributor

@arashsheyda arashsheyda commented Apr 10, 2026

Description

Note

Requires Vite 8+ (DevTools Kit uses the plugin.devtools hook
introduced in Vite 8).

closes #9

this PR adds support for vite devtools integration with playground.

Usage:

check out https://github.com/comarkdown/comark/pull/102/changes#diff-0bffb03d8c49a00cae04014114b0d848afea2cddf16768a45ce13291919735bd

How to test

  1. Install dependencies from the repo root:

    pnpm install
  2. Run the Vue + Vite example (already configured with @vitejs/devtools):

    pnpm dev:vue
  3. Open the app in the browser. the DevTools floating panel should appear at the bottom of the page. Click the Comark icon in the dock to open the playground iframe.

Screenshot 2026-04-09 at 9 38 16 PM

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 10, 2026

@arashsheyda is attempting to deploy a commit to the NuxtLabs Team on Vercel.

A member of the Team first needs to authorize it.

@arashsheyda arashsheyda marked this pull request as draft April 10, 2026 03:41
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 10, 2026

Open in StackBlitz

comark

npm i https://pkg.pr.new/comarkdown/comark@102

@comark/ansi

npm i https://pkg.pr.new/comarkdown/comark/@comark/ansi@102

@comark/html

npm i https://pkg.pr.new/comarkdown/comark/@comark/html@102

@comark/nuxt

npm i https://pkg.pr.new/comarkdown/comark/@comark/nuxt@102

@comark/react

npm i https://pkg.pr.new/comarkdown/comark/@comark/react@102

@comark/svelte

npm i https://pkg.pr.new/comarkdown/comark/@comark/svelte@102

@comark/vue

npm i https://pkg.pr.new/comarkdown/comark/@comark/vue@102

commit: cde04d8

@arashsheyda
Copy link
Copy Markdown
Contributor Author

@farnabaz @atinux trying to add vite devtools support here: the vue package has a vite entry so we can include the devtools there, but the others (like svelete or react) they don't have that entry so I thought user can incldue the devtools as a plugin... does that makes sense? or do we want to add vite entries for those packages as well

current example usage for react:

import { DevTools } from '@vitejs/devtools'
import { comarkDevtools } from 'comark/vite'
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'

export default defineConfig({
  plugins: [
    DevTools(),
    react(),
    comarkDevtools(),
  ],
})

@arashsheyda arashsheyda marked this pull request as ready for review April 15, 2026 20:11
Copy link
Copy Markdown

@antfu antfu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise LGTM, thanks!

Comment thread packages/comark/package.json Outdated
Comment thread packages/comark/src/vite.ts Outdated
@atinux
Copy link
Copy Markdown
Contributor

atinux commented Apr 16, 2026

Would you be happy to share a video about the devtools here @arashsheyda ?

@arashsheyda
Copy link
Copy Markdown
Contributor Author

arashsheyda commented Apr 16, 2026

sure, @atinux you mean like this?

Screen.Recording.2026-04-16.at.2.43.07.PM.mov

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 17, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
comark Error Error Apr 17, 2026 1:32pm

@farnabaz
Copy link
Copy Markdown
Contributor

Nice Work 👍
This is great start, but having website playground is not quite useful IMO.
It would be great if:

  • devtools detects <Comark>/<ComarkRender> and get the content out of it and allow user to edit right in playground.

Not sure what is the best way achieve this 🤔 Maybe we can provide global utility for dev mode.

@farnabaz
Copy link
Copy Markdown
Contributor

May be wild but:

  • We can us DOM element to get access to tree document.querySelector('.comark-content').__vnode.ctx.props.tree
  • The convert to markdown and show editor in devtools to edit it
  • Update component props document.querySelector('.comark-content').__vnode.ctx.props.tree = updated tree
  • And re-render the element document.querySelector('.comark-content').__vnode.ctx.update()

Of course this only works for Vue. Maybe @antfu could help us on this and finding best universal solution 👼

@antfu
Copy link
Copy Markdown

antfu commented Apr 21, 2026

I am working on the utilities/infra for DevTools kit to work on the hosted website: vitejs/devtools#294 which might benefit this PR

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.

[Feature Request]: devtools tab for nuxt integration

4 participants