How suptimio/liveview works
Viewlife is a VS Code custom editor for Markdown. The principal workflow is opening a Markdown document, rendering it in an editable webview, and sending edits back to the VS Code document so normal saving and undo apply. The webview also supports tables, styling and PDF export. Edges reflect calls visible in excerpts or capabilities documented in the README; unsampled stylesheet and message handling are represented only where documented, so some connections are omitted.
Main entry points: main.ts Live edit workflow · extension.ts Custom editor host · vdom.ts DOM patching · markdown.ts Markdown parser
Components 17
VS Code integration
- Custom editor host
src/extension.ts - Editor webview
webview/src/main.ts
Markdown editing
- Live edit workflow
webview/src/main.ts - Selection handling
webview/src/selection.ts - Markdown parser
webview/src/markdown.ts - DOM patching
webview/src/vdom.ts - Inline previews and tables
webview/src/preview.ts
Rendering and styles
- Render profiles
webview/src/profiles.ts - Theme selection
webview/src/theme.ts - Paper styles
webview/src/style.css - Editor UI styles
webview/src/ui.css - Custom stylesheets
src/extension.ts
Export
- PDF generation
webview/src/exporter.ts
Other components
- Markdown author
- VS Code
- Markdown document
- Workspace files
Connections 21
- Markdown author → VS Code: opens Markdown
README.md - VS Code → Custom editor host: routes editor
src/extension.ts - Custom editor host → Markdown document: reads and edits
src/extension.ts - Custom editor host → Editor webview: hosts
src/extension.ts - Editor webview → Live edit workflow: runs
webview/src/main.ts - Live edit workflow → Markdown parser: parses source
webview/src/main.ts - Live edit workflow → Selection handling: reads selection
webview/src/main.ts - Live edit workflow → DOM patching: patches DOM
webview/src/main.ts - Markdown parser → DOM patching: produces nodes
webview/src/markdown.ts - DOM patching → Inline previews and tables: patches previews
webview/src/vdom.ts - Inline previews and tables → Live edit workflow: dispatches table edits
- Live edit workflow → Markdown document: sends edits
README.md - Markdown document → Live edit workflow: refreshes content
- Live edit workflow → Render profiles: sets profile
webview/src/main.ts - Live edit workflow → Theme selection: sets theme
webview/src/main.ts - Render profiles → Paper styles: selects overrides
- Live edit workflow → Custom stylesheets: requests stylesheets
- Custom stylesheets → Workspace files: reads CSS
src/extension.ts - Live edit workflow → PDF generation: starts export
webview/src/main.ts - PDF generation → Custom editor host: sends PDF
- Custom editor host → Workspace files: saves PDF