Run the shipped Go editor command:
markata editor --workspace ./docs
Open the local URL printed by the command. Edit Markdown on the left and view the preview on the right.
Press Ctrl+C to stop the server. The default address is 127.0.0.1:8766.
For a checkout build, run go run ./cmd/markata-go editor --workspace ./docs.
The Go server calls Markata’s standalone renderer directly. It starts no Python process and needs no WASM runtime. It uses the same Markdown renderer as the Python API and FastAPI editor. The preview does not build a site. The language service indexes Markdown and reads workspace configuration for existing mention support.
Understand startup and site index timing #
The editor startup has distinct milestones. The CLI prints elapsed time for workspace discovery/watcher setup, LSP preparation, and appearance/browser assets. Once the HTTP listener is ready, the browser still loads its source file list and lazily requests frontmatter plus the site link index; these are not part of the initial server-ready message.
The workspace sidebar shows Loading site index… with real phases: waiting for metadata, reading frontmatter, constructing the link index, and ready/error. Expand Site index ready afterward to see file counts and the measured index load time (frontmatter parsing and link construction separately), configured feed assembly and metadata HTTP timing, browser file list readiness, and time to the first usable preview. Copy diagnostics captures a local JSON snapshot of those counts and durations, not document contents.
For a local command-line check:
curl -s http://127.0.0.1:8766/workspace/index-status
curl -sD - -o /dev/null 'http://127.0.0.1:8766/workspace?metadata=true'
The first command is lightweight and does not initiate indexing. The second
explicitly loads metadata and returns a Server-Timing: site-index;dur=…
header (and a site-feeds;dur=… value for configured feed assembly). This is local diagnostic telemetry, not a distributed tracing system;
there is no automatic upload of timing data. If it exposes a slow stage on
a large site, the next step is to profile that stage rather than guess at a
percentage-complete bar. Related: #1987.
Use the appearance picker to select a palette, color mode, style, font, or text size. Open Editor settings to choose line wrapping, keymap, and layout. Drag the divider between the source and preview panes to resize them. Choose Editor only or Preview only to focus on one pane; Editor and preview restores the split. Scrolling either pane keeps the corresponding Markdown visible in the other. When you write or move the cursor, the preview follows the editor. Scroll sync is on by default; turn off Sync editor and preview scrolling in Editor settings to scroll each pane independently. The choice is saved in this browser. At the end of a document, both panes keep extra scroll space so the last lines can move above the bottom edge while you write. In split view, a subtle marker shows the corresponding preview block, with a thin caret and You flag at the active location. When rendered text matches the source line, the preview caret follows the character cursor. For content that a renderer transforms or replaces, it falls back to the nearest mapped source position. Click rendered text to move the source caret to the matching text when possible; links keep their normal navigation behavior. The source pane keeps its normal caret on the actual text cursor. With the Vim keymap, the preview caret changes shape for normal, insert, replace, and visual modes. Preview updates preserve unchanged blocks, and layout changes refresh the source-to-preview mapping, including after images and fonts load. While you edit, the preview follows the caret after the matching content update completes, including when you keep typing on the same line. Scroll changes caused by a render or a delayed image/font layout are not mistaken for manual scrolling. The preview marker is subtle and marks the rendered block for the current caret line. Nested Markdown container boundaries add source anchors to improve scroll alignment in long sections; these markers exist only in the preview render and do not change your source. Within nested content, the marker follows the narrowest container that contains the caret line. For the Go site-backed workbench, Editor settings → Keyboard shortcuts… opens application-wide key bindings. Choose Writer, VS Code, Vim, or Emacs application presets independently of the editor’s Default/Vim/Emacs/Sublime text keymaps. The command palette also exposes Editor keymap: Default, Vim, Emacs, and Sublime. Selecting one uses the existing editor keymap preference; it does not change the independent Writer/VS Code/Vim/Emacs application shortcut preset. This lets writers change editing motions without navigating to Settings. The command palette displays active shortcuts; the registry also supports multi-key chords, search, per-preset overrides, and resets. The preview pane includes a Back to editor control for keyboard navigation. See Keyboard shortcuts.
Choose Default, Vim, Emacs, or Sublime keymaps in Editor settings.
In Vim mode, press / to search forward, ? to search backward, then n or
N to move between matches.
Code highlighting, icons, admonitions, tables, checklists, Mermaid, and Chart.js use local assets.
Press Ctrl+P (Cmd+P on macOS) to find a site file by its path, title, slug, or tag. The finder shows the current and recently opened files when its search is empty. Select a result or press Enter to open it in the editor. The sidebar also has a collapsible Recent files section for the last eight workspace documents opened on this device. It is saved per workspace in browser storage, works without network access, and excludes unsaved scratch drafts. Select any recent entry to reopen it; the entry list quietly ignores files no longer in the workspace. You can collapse it when you need more room. Choose Feeds or Tags in the workspace selector to browse posts by feed or tag. Feed names are shown as roots with folders relative to the workspace.
Edits to selected site files save back to the workspace after a short pause. Unsaved scratch documents stay in browser storage. The browser also keeps a recovery copy of workspace edits. Use Ctrl+Shift+P and search for Download current file to export a copy, or Open Markdown file to import a file as an unsaved draft. A storage error appears beside the render metrics. Editing and downloads remain available. The server writes only selected workspace files. Scratch drafts remain local to the browser origin, so drafts on one port remain separate from drafts on another. Workspace saves and new-post creation require a same-origin browser request. The server rejects missing or foreign origins before it changes a site file.
The preview updates after a 100 ms pause. One request runs at a time, and newer edits replace pending edits.
Old responses cannot replace a newer draft. Errors preserve the last successful preview.
The footer shows Go render time, total edit-to-preview time, source size, and preview size.
Repeated source uses a one-entry memory cache. Appearance changes update the preview without a render request.
Workspace post embeds in <!-- embed not found: post-slug --> ![[post-slug]] or  format
render as cards linked to the matching site post. Fenced code examples remain
literal source.
Language assistance #
The editor connects to the existing Markata LSP through /lsp over WebSocket.
The server indexes the directory from --workspace. The default directory is the current directory.
The browser LSP accepts same-origin connections on localhost or a loopback IP only.
Type [[ for wiki-link suggestions, including aliases. Type [label]( for Markdown document paths.
Automatic suggestions wait for a short typing pause. Press Ctrl+Space to request suggestions immediately at the cursor. Use the arrow keys and Enter to select a suggestion.
Existing frontmatter, admonition, and mention completion also use the LSP.
Broken wiki links receive an underline. The underline tooltip shows the diagnostic message.
The workbench preview resolves valid [[wikilinks]] against the site’s workspace index.
Click a resolved wikilink in the preview to open that post in the editor.
Select the error and warning counts in the bottom status bar to inspect diagnostics and
jump to their source locations.
The editor sends unsaved text as a synthetic .markata/browser-draft.md document.
This document stays in memory. Markdown path suggestions start at the workspace root because the draft has no source file.
The Files tree opens source files from the selected workspace using Markata glob rules. The Feeds view groups files by configured feed filters, and the Tags view groups them by loaded frontmatter. The selector shows file, feed, and tag counts. See workspace navigation.
Each WebSocket connection owns its own draft and index. Reload the page to index external file changes.
Edit page properties #
Select a site file, then choose Properties to edit its frontmatter in the full-height page-details view. The live preview stays visible beside it. Choose Back to Markdown to return to the source, or Edit YAML to work directly with the frontmatter block. Press Escape to return to the article. The command palette also has actions to open page details, add a property, and return to Markdown.
The page summary shows the title, URL slug or source path, and publication state. Common fields appear first. Choose Add property, search for a known field, and select it. Open Custom property to add a site-specific YAML field. Edit tags as chips: remove one tag at a time or enter a tag and choose Add. Advanced fields remain available under Show advanced properties.
Property edits update the Markdown source and use the normal workspace save and preview behavior. Press Ctrl+Z or Cmd+Z to undo an edit. Use Remove to delete a property from the page.
The footer reports the language connection state. Editing and preview continue if the connection fails. Reload the page to reconnect. The browser adapter is shared with the FastAPI example.
For an embedded application, use workbench.NewWithWorkspace(ctx, root).
Cancel ctx during shutdown to close active language connections.
workbench.New() uses the current directory and the lifetime of the application.
WebSocket protocol #
GET /lsp/config returns rootUri and documentUri for the selected workspace.
Connect to /lsp with the page origin. Each WebSocket text message contains one JSON-RPC object.
WebSocket messages omit the stdio Content-Length headers.
Send initialize, initialized, and textDocument/didOpen before language requests.
The session accepts the synthetic draft URI from the configuration response.
The server ignores browser workspace-change notifications and overrides the client workspace during initialization.
Browser completion responses contain at most 200 suggestions. More specific text requests a new list. Messages have a 2 MiB limit. A disconnect releases the session. The endpoint rejects missing or foreign origins. It provides no authentication or shared workspace management. Keep this example on a trusted local address.
Embed the handler #
Mount the handler at the root of a dedicated origin:
package main
import (
"log"
"net/http"
"time"
"github.com/WaylonWalker/markata/pkg/workbench"
)
func main() {
handler, err := workbench.New()
if err != nil {
log.Fatal(err)
}
server := &http.Server{
Addr: "127.0.0.1:8767", Handler: handler,
ReadHeaderTimeout: 5 * time.Second,
}
log.Fatal(server.ListenAndServe())
}
Create one handler at startup. It prepares the shared appearance bundle once. The handler owns no listeners, signal handlers, or application configuration. A future builder can embed it without the demo command.
Render API #
curl http://127.0.0.1:8767/render \
-H 'Content-Type: application/json' \
-d '{"markdown":"# Hello Go","appearance":{"data-theme":"light"}}'
The first editor request receives a complete preview document. Later requests use "include_document": false and receive fragments.
The iframe keeps its document, shared styles, and loaded libraries between edits.
New features add their styles once; removed features remove their conditional styles.
Chart instances are destroyed before replacement, and feature scripts initialize the new content.
The JSON response contains document, html, feature_head_html, body_end_html, and cached.
Metrics include render_ms, input_bytes, html_bytes, and document_bytes.
With include_document set to false, document is null and document_bytes is zero.
Omit this option to retain the original full-document response.
The Server-Timing response header also reports render time.
document contains a complete HTML preview with links to this server’s assets.
Keep the server available while you view the document.
Optional appearance keys are data-theme, data-palette, data-aesthetic, data-fontpack, and data-text-size.
Values must occur in the bundled appearance catalogs.
The API rejects unknown fields, malformed JSON, and invalid appearance choices with HTTP 400.
It returns HTTP 413 for source above 200,000 UTF-8 bytes or a request above 1 MiB.
Requests need application/json. Cross-origin render requests receive HTTP 403.
The handler runs one render at a time. Canceled requests leave the queue before rendering. An active render completes before the next render starts. The browser stops waiting after 30 seconds. The demo server has read and write timeouts.
This editor supports trusted local authoring. Authored HTML and styles remain available inside an opaque-origin iframe sandbox. Only renderer-generated scripts run during fragment updates. Reload the page to apply changes to authored scripts. Preview scripts cannot read the editor’s DOM or storage. Authored links and images can access external networks. Keep the default loopback binding for local use. Add authentication and suitable resource controls before remote deployment.
All built-in assets come from the server. Offline reload is not supported. For site builds and site-specific plugins, use the normal CLI.
Check persistent preview updates #
Start the Go workbench, then run its browser regression tests:
MARKATA_GO_WORKBENCH_URL=http://127.0.0.1:8767 \
MARKATA_TEST_CHROMIUM=/usr/bin/chromium \
uv run --with playwright python python/test_go_editor_browser.py -v
Set MARKATA_TEST_CHROMIUM to your Chromium executable.
The tests check retained stylesheets, fragment responses, conditional styles, charts, and diagrams.
The publishing browser test uses its own temporary Git site and bare remote. It edits page properties, reviews the rendered and source diffs, commits an edited message, and pushes only to that temporary remote:
go build -o /tmp/markata-go-editor ./cmd/markata-go
MARKATA_GO_EDITOR_BINARY=/tmp/markata-go-editor \
uv run --with playwright python -m unittest python.test_go_editor_publish_flow -v
The pull request fast gate runs this test when Python browser-test files change. It installs Chromium and uses the same disposable Git fixture.
Benchmark the server #
The integration benchmark guide compares seven existing fixtures with the Python reference. It separates initial renders, uncached edits, and cached edits. Raw samples and reproduction commands are included.
Shared editor behavior #
Use the command palette to import or export a Markdown file. An oversized import leaves the current document intact.
Search for New Post in the command palette to open a fuzzy picker for
built-in starters and .md files in the site’s templates/ directory. Choose
a starter to open its details form. The title and destination folder start with
template defaults. The slug field stays empty when using the suggestion; its
ghost text and the destination path update as the title changes. Enter a custom
slug only when you want to override the title-derived filename. Creating the
post opens the new file in the editor, where later edits autosave to the site.
The footer reports whether the draft was saved. Storage failures leave editing and downloads available.
See shared editor features and runtime differences for the comparison.
Command palette and Markdown commands #
Select Commands or press Ctrl+Shift+P (Cmd+Shift+P on macOS). Search for special syntax, then press Enter to insert it at your selection. See the command palette guide for the catalog and keyboard controls.
To open the command palette with a complete example loaded, visit /?example.
Review changes before publishing (experimental) #
When editing a Markdown file inside a Git-backed workspace, select Publish
in the upper-right header, search for Publishing: Review & Publish in the
command palette, or press Ctrl/Cmd+S or Ctrl/Cmd+Shift+Enter. Vim mode
also accepts :w; Emacs mode accepts Ctrl-X Ctrl-S. Each opens the same
review dialog; none of them publishes immediately.
The dialog first waits until the exact text in the editor has been saved to the workspace. It then compares that saved source with the file from the last Git commit. Rendered diff opens first. Side by side shows both rendered versions and keeps matching sections in view while you scroll; mobile can switch between versions by tapping or swiping. Source diff shows unified Markdown, and Full diff opens the detailed source viewer. The Commit message tab shows the message for the local commit and lets you edit it. Metadata chips identify draft/published flag changes, slug changes, and conflicting publication flags.
The review can create a local Git commit for the selected page, using the message shown in the Commit message tab. After that commit, Push to origin is a separate action. Pushing does not prove that a deployment succeeded; when Builder Admin verification is configured, Check live status can confirm the deployed source revision. “Last committed” is not necessarily the live site revision. A scratch file must first be created or opened as a workspace Markdown post. If the workspace has no Git history, the review reports this rather than assuming a baseline.
The publish contract and planned deployment safety gates are defined in Editor publishing.
Verify a remote publication with Builder Admin (opt-in) #
Publishing has deliberately separate steps: review the exact Markdown and
frontmatter, commit only that selected page, then explicitly push to origin.
A successful push does not prove the site is live.
For a site deployed through Markata Builder Admin, the local editor can optionally verify the current release’s recorded source Git commit:
export MARKATA_PUBLISH_BUILDER_URL="https://builder.example.com"
export MARKATA_PUBLISH_BUILDER_TOKEN="<your authorized bearer token>"
markata editor --workspace ./site
Use an API token authorized for Builder Admin’s /api/v1/state. The editor
stores neither the token nor builder URL in the browser; the local backend
makes a short, authenticated, server-side GET request. Remote builder URLs
must use HTTPS (loopback HTTP is permitted for development). Redirects are
not followed, so bearer tokens cannot be forwarded to a different host.
After pushing, select Check live status. This checks
revision.live_source_commit, with a fallback to the current release’s
source revision when available. It reports Live · Verified only if that
revision matches the exact pushed SHA. Unknown revision, unavailable API,
unconfigured auth, failed build, and different live SHA never count as success.
This verification identifies the release’s source Git revision, not its byte-for-byte rendered output, CDN cache rollout, or availability at every public edge. Site URL health checks and other deployment providers need dedicated follow-up adapters.