modscode JA

modscode / Gallery / md

md

Read, write and review markdown with Claude in a pane inside Claude Code: drafts stream in, comments stay on their words, and Claude suggests edits you accept or reject.

Code you can checkTerminal + desktopPaneToastBoxButtonClientInputText

What it does

  • Draws a pane, toasts
  • Adds /md
  • Watches mcp__md__view, mcp__md__reply, mcp__md__open, mcp__md__close calls
  • Hooks session.start, turn.step, ui.message, ui.scroll
  • Keeps its own state between turns

Good points

  • No network calls
  • Written in TypeScript
  • Handles errors

Code to start from

Two kinds: a starter modscode writes from the design above, and the lines of the mod's own code that draw it.

Starter (register.tsx)

register.tsx
import type { Register } from 'claude-code'

// Drawn like md by Dave Kiss (pane, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/davekiss-md/
// Written by modscode from that reading, not copied from the mod: use it as you like.
// Each value below stands for one the mod works out at run time; put in your own.
export const register: Register = on => {
  // the pane: open it with $.ui.open({ id: 'my-pane', title: "Open markdown" })
  on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
    const { Box, Text, Button, Client } = $.ui.resolve(e)
    const relative = '…'
    const excerpt = '…'
    const countWords = '…'
    const words = '…'
    const length = '…'
    const size = '…'
    const label = '…'
    const stale = '…'
    const value = '…'
    const alt = '…'
    const src = '…'
    const head = '…'
    const note = '…'
    const head2 = '…'
    const note2 = '…'
    const head3 = '…'
    const note3 = '…'
    const head4 = '…'
    const reply = '…'
    const head5 = '…'
    const reply2 = '…'
    const head6 = '…'
    const reply3 = '…'
    const draft = '…'
    const submit = '…'
    return (
      <Box flexDirection="column">
        <Box flexDirection="row" columnGap={2}>
          <Text bold wrap="truncate-start">
            {relative}
          </Text>
          <Text dimColor>
            {`“${excerpt}” · ${countWords} of ${words} words`}
            {" ·"}
            {" "}
            {length}
            {" open"}
            {` · ${size} changed`}
            {` · ${length} suggested`}
            {" · ✎ Claude is writing…"}
          </Text>
        </Box>
        <Box flexDirection="column">
          <Box flexDirection="row" columnGap={2}>
            <Button hotkey={0} label={`${label}`} plain dimColor />
            <Button hotkey={0} label={`${label}`} plain dimColor />
            <Button hotkey={0} label={`${label}`} plain dimColor />
            <Button hotkey={0} label={`${label}`} plain dimColor />
            <Button hotkey={0} label={`${label}`} plain dimColor />
            <Button hotkey={0} label={`${label}`} plain dimColor />
            <Button hotkey={0} label={`${label}`} plain dimColor />
            <Button hotkey={0} label={`${label}`} plain dimColor />
            <Button hotkey={0} label={`${label}`} plain dimColor />
            <Button hotkey={0} label={`${label}`} plain dimColor />
          </Box>
          <Box flexDirection="row" columnGap={2}>
            <Button hotkey={0} label={`${label}`} plain dimColor />
            <Button hotkey={0} label={`${label}`} plain dimColor />
            <Button hotkey={0} label={`${label}`} plain dimColor />
            <Button hotkey={0} label={`${label}`} plain dimColor />
            <Button hotkey={0} label={`${label}`} plain dimColor />
            <Button hotkey={0} label={`${label}`} plain dimColor />
          </Box>
        </Box>
        <Text dimColor>
          Click to place the caret, drag to select, type to edit · ctrl+k comment, ctrl+j ask, ctrl+u undo, tab to buttons
        </Text>
        <Client module="./editor.tsx" />
        <Text dimColor>
          {stale}
          {" comment(s) lost their lines after an edit."}
        </Text>
        <Text dimColor>
          ────────
        </Text>
        <Box flexDirection="column">
          <Text dimColor wrap="truncate-end">
            {`${alt} · ${src}`}
          </Text>
        </Box>
        <Box flexDirection="column">
          <Text color="magenta" wrap="wrap">
            {head}
          </Text>
          <Box flexDirection="row" columnGap={2}>
            <Text dimColor wrap="truncate-end">
              {note}
            </Text>
            <Button hotkey="y" label="accept" />
            <Button hotkey="d" label="reject" plain dimColor />
            <Text dimColor>
              tab, then y / d
            </Text>
          </Box>
        </Box>
        <Box flexDirection="column">
          <Text color="magenta" wrap="wrap">
            {head2}
          </Text>
          <Box flexDirection="row" columnGap={2}>
            <Text dimColor wrap="truncate-end">
              {note2}
            </Text>
            <Button hotkey="y" label="accept" />
            <Button hotkey="d" label="reject" plain dimColor />
            <Text dimColor>
              tab, then y / d
            </Text>
          </Box>
        </Box>
        <Box flexDirection="column">
          <Text color="magenta" wrap="wrap">
            {head3}
          </Text>
          <Box flexDirection="row" columnGap={2}>
            <Text dimColor wrap="truncate-end">
              {note3}
            </Text>
            <Button hotkey="y" label="accept" />
            <Button hotkey="d" label="reject" plain dimColor />
            <Text dimColor>
              tab, then y / d
            </Text>
          </Box>
        </Box>
        <Box flexDirection="column">
          <Text color="yellow" wrap="wrap">
            {head4}
          </Text>
          <Text color="green" wrap="wrap">
            {reply}
          </Text>
        </Box>
        <Box flexDirection="column">
          <Text color="yellow" wrap="wrap">
            {head5}
          </Text>
          <Text color="green" wrap="wrap">
            {reply2}
          </Text>
        </Box>
        <Box flexDirection="column">
          <Text color="yellow" wrap="wrap">
            {head6}
          </Text>
          <Text color="green" wrap="wrap">
            {reply3}
          </Text>
        </Box>
        <Text wrap="truncate-start">
          <Text bold>
            {label}
            {": "}
          </Text>
          {draft}
          <Text inverse>
            {" "}
          </Text>
          <Text dimColor>
            {" Enter to "}
            {submit}
            , empty to cancel
          </Text>
        </Text>
      </Box>
    )
  })

  on('session.start', async ($, e, next) => {
    const docName = '…'
    const err = '…'
    const what = '…'
    await $.ui.toast(`Could not open ${docName}: ${err}`)
    await $.ui.toast(`Copied ${what}`)
    return next(e)
  })
}

The mod's own code

Shown under the mod's licence (MIT); its text is below. Keep the notice if you copy these lines.

hooks/register.tsx lines 1109–1268 · Pane
  on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e, next) => {
    if (e.surface === 'mobile') return next(e)
    if (e.surface === 'vscode') return next(e)
    const E = $.ui.resolve(e)
    const { Box, Text, Button, Input, Client } = E
    const doc = await read($, docAtom)
    const picker = await read($, pickerAtom)
    if (picker) {
      const cwd = await $.session.cwd()
      const label = (f: string | null) =>
        f === null ? 'Untitled draft  · unsaved' : relative(f, cwd) + (picker.files.indexOf(f) < picker.recent ? '  · recent' : '')
      const entries = [...(picker.hasDraft ? [null] : []), ...picker.files]
      const matches = entries.filter(f => fuzzy(picker.filter, label(f))).slice(0, 15)
      return (
        <Box flexDirection="column">
          <Input
            key="pick-filter"
            label="Open"
            value={picker.filter}
            placeholder="type to filter, or a path"
            submitLabel="open"
            autoFocus
            onInput={v => void update($, pickerAtom, p => p && { ...p, filter: v })}
            onSubmit={v => void (matches.length ? openPicked($, matches[0] ?? null) : newFile($, v))}
          />
          <Button
            key="pick-new"
            label={picker.filter.trim() ? `+ New file ${markdownName(picker.filter)}` : '+ New file'}
            plain
            onPress={() => void newFile($, picker.filter)}
          />
          {matches.map((f, i) => (
            <Button
              key={'pick-' + i}
              label={label(f)}
              plain
              onPress={() => void openPicked($, f)}
            />
          ))}
          {matches.length === 0 && <Text dimColor>No markdown files match. Enter creates {markdownName(picker.filter)}.</Text>}
          <Button
            key="pick-cancel"
            label="cancel"
            plain
            dimColor
            onPress={() => void (async () => {
              await update($, pickerAtom, () => null)
              if (!(await read($, docAtom))) await $.ui.close({ id: PANE })
            })()}
          />
        </Box>
      )
    }
    if (!doc) return <Text dimColor>No file open. Run /md to pick one.</Text>

    const comments = await read($, commentsAtom)
    const cursor = await read($, cursorAtom)
    const col = await read($, colAtom)
    const mark = await read($, markAtom)
    const mode = await read($, modeAtom)
    const draft = await read($, draftAtom)
    const writing = await read($, writingAtom)
    const reader = await read($, readerAtom)
    const changed = new Set(await read($, changedAtom))
    const cwd = await $.session.cwd()
    const total = doc.lines.length
    const sel = ordered(mark, { line: cursor, col })
    const excerpt = sel ? textBetween(doc.lines, sel[0], sel[1]) : null
    const short = (t: string, n: number) => (t.length > n ? t.slice(0, n - 1).replace(/\s+/g, ' ') + '…' : t.replace(/\s+/g, ' '))
    const open = comments.filter(c => c.status !== 'resolved')
    const here = comments.filter(c => c.status !== 'resolved' && c.start <= cursor && cursor <= c.end)
    const suggested = (await read($, suggestionsAtom)).flatMap(s => {
      const span = locate(doc.lines, s)
      return span ? [{ s, span }] : []
    })
    const suggestedHere = suggested.filter(({ span }) => span[0].line <= cursor && cursor <= span[1].line)
    const focus = await read($, focusAtom)
    const pixels = await pixelsAvailable($)
    const words = countWords(doc.lines.join('\n'))
    const bodyRows = e.props.scroll.bodyRows || 20
    const page = Math.max(5, bodyRows - 8)

    const move = (to: number) => placeCaret($, { line: Math.max(1, Math.min(total, to)), col: 0 }, false)
    // The toolbar's prompts type into the pane's Input, never a draft
    const setMode = async (m: Mode) => {
      await update($, draftAtom, () => null)
      await update($, modeAtom, () => m)
    }
    const nextComment = () => {
      const after = open.map(c => c.start).filter(s => s > cursor).sort((a, b) => a - b)
      const first = open.map(c => c.start).sort((a, b) => a - b)
      return move(after[0] ?? first[0] ?? cursor)
    }

    const key = (k: string, label: string, onPress: () => unknown) => (
      <Button key={'k-' + k} hotkey={k} label={label} plain dimColor onPress={() => void onPress()} />
    )

    const header = (
      <Box flexDirection="row" columnGap={2}>
        <Text bold wrap="truncate-start">{doc.path ? relative(doc.path, cwd) : docName(null)}</Text>
        <Text dimColor>
          {excerpt ? `“${short(excerpt, 24)}” · ${countWords(excerpt)} of ${words} words` : `${cursor}:${col + 1} · ${words} words`} ·{' '}
          {open.length} open
          {changed.size > 0 ? ` · ${changed.size} changed` : ''}
          {suggested.length > 0 ? ` · ${suggested.length} suggested` : ''}
          {doc.path === null ? (writing ? ' · ✎ Claude is writing…' : ' · unsaved, /md save <path>') : ''}
        </Text>
      </Box>
    )

    const toolbar = (
      <Box flexDirection="column">
        <Box flexDirection="row" columnGap={2}>
          {key('j', '↓', () => move(cursor + 1))}
          {key('k', '↑', () => move(cursor - 1))}
          {key('f', 'pg↓', () => move(cursor + page))}
          {key('b', 'pg↑', () => move(cursor - page))}
          {key('v', mark ? 'clear' : 'select', () => update($, markAtom, m => (m ? null : { line: cursor, col })))}
          {key('o', 'copy', () => copyOut($))}
          {key('i', 'image', () => pasteImage($))}
          {key('z', focus ? 'unfocus' : 'focus', async () => {
            await update($, focusAtom, v => !v)
            await keepVisible($)
          })}
          {key('n', 'next', nextComment)}
          {key('r', 'read', async () => {
            const blocks = blocksOf(doc.lines)
            await update($, readTopAtom, () => blocks[blockAt(blocks, cursor)]?.start ?? 1)
            await update($, readerAtom, () => true)
          })}
        </Box>
        <Box flexDirection="row" columnGap={2}>
          {key('c', 'comment', () => setMode('comment'))}
          {key('a', 'ask', () => setMode('ask'))}
          {key('x', 'send all', async () => {
            if (open.length === 0) return $.ui.toast('No open comments to send.')
            void $.prompt.submit({ text: reviewPrompt(doc.path, doc.lines, open), asUser: true })
            $.ui.toast(`Sent ${open.length} comment(s) to Claude.`)
          })}
          {key('s', 'resolve', () =>
            saveComments($, comments.map(c => (here.some(h => h.id === c.id) ? { ...c, status: 'resolved' } : c))),
          )}
          {key('u', 'undo', () => undo($))}
          {key('q', 'close', () => $.ui.close({ id: PANE }))}
        </Box>
      </Box>
    )

    const prompts = {
      comment: { label: excerpt ? `Note on “${short(excerpt, 22)}”` : `Comment on line ${cursor}`, submit: 'save' },
      ask: { label: excerpt ? `Ask about “${short(excerpt, 22)}”` : `Ask Claude about line ${cursor}`, submit: 'send' },
    }
    const active = mode === 'review' ? null : prompts[mode]
    const input =
      active &&
      (draft !== null ? (
        <Text key={'draft-' + mode} wrap="truncate-start">
          <Text bold>{active.label}: </Text>
          {draft}
hooks/register.tsx lines 675–683 · Pane
function drawPreview(E: PaneElements, key: string, p: Preview, alt: string) {
  const { Image, Raster } = E as unknown as {
    Image: (props: Record<string, unknown>) => ReturnType<PaneElements['Text']>
    Raster: (props: Record<string, unknown>) => ReturnType<PaneElements['Text']>
  }
  return p.kind === 'pixels'
    ? <Image key={key} source={{ file: p.file, format: 'png', generation: p.generation }} columns={p.columns} rows={p.rows} alt={alt || 'image'} />
    : <Raster key={key} columns={p.columns} rows={p.rows} cells={p.cells} />
}
Licence text (MIT)
MIT License

Copyright (c) 2026 Dave Kiss

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

What its code calls

runs programswrites filesenv varsdrives Claudetool callsremembers

The design, read from code

Drawn from the mod's source at the commit read, not from a run: a list is drawn three times, a condition takes its first branch that draws in the desktop app, and a value only the run time knows is shown as a made-up sample (dotted underline) or left out. Colours and type are this site's.

What its code shows

Read from the source at commit 5173add8dbe7 on 2026-10-06. The first group decides whether a mod is listed; the rest is for you to weigh. A later commit is not read until the next crawl.

Decides the listing: code you can check
Entry readEvery module hooks/hooks.json names was read.hooks/register.tsx
ParsesEvery file parses as TypeScript or JavaScript.5 files parsed
All its code is in the modEvery import is a file of the mod or the engine's own module; no packages, no require.all its code is in the mod
ReadableNo minified lines, no eval or new Function, no import of a computed path, no encoded blobs.no minified code, no eval, no encoded blobs
Calls in the openNetwork and programs are reached as $.http.fetch and $.process.run in place, never passed around.every call outside goes through $ in the open
For you to weigh before installing
Where it drawsThe terminal, the desktop app, both, or nothing (hooks only: a guard or a prompt rewriter), as its code says. Shown, never a reason to leave a mod out.draws in the terminal and the desktop app, the same in both
Install lineWhether its repository's own .claude-plugin/marketplace.json lists it, so it installs from that marketplace with the lines on its page.its repository's .claude-plugin/marketplace.json does not list it: no install line to give
Programs on WindowsWhether every program it starts through $.process exists on Windows (tail, date, open, osascript, /usr/… do not).hooks/register.tsx:448 mkdir (not on Windows)
NetworkWhether every fetch names its https host in the code.no network
ProgramsWhether every program it starts is named in the code and is not a shell, an interpreter or a network tool.hooks/register.tsx:442 osascript (a shell or interpreter); hooks/register.tsx:449 osascript (a shell or interpreter)
Reads and sendsWhether it both reads files or environment variables and reaches the network.reaches no network
Keys in the sourceWhether the source holds what looks like an API key or a private key.no keys in the source
LicenceAn open licence (MIT, Apache-2.0, BSD, ISC, Unlicense, 0BSD, CC0) with its text lets modscode show its code; otherwise the code is linked.MIT

This is a reading of the code text, not a security review: it does not run the mod, and it cannot see what a program the mod starts does. The check before installing is yours. How mods are chosen

Install it

Check it yourself before you install it. Mods run unsandboxed, with your permissions, and modscode does not vouch for what this code does. Read the code below (or run claude plugin validate . in its folder), weigh what it reaches, and install the commit you read.

Its repository's .claude-plugin/marketplace.json does not list it, so there is no install line to give. Read it as code, or follow its author's README.

Ask Claude about it

With the modscode connector added, Claude can read this design, what its code reaches and its code, and build on them. Ask it like this:

Read the modscode design "davekiss-md" with its code and make me a pane like it

Search them from Claude: the MCP connector

Similar designs