diff options
| author | Craig Jennings <c@cjennings.net> | 2026-06-16 07:08:55 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-06-16 07:08:55 -0500 |
| commit | 0682b24f27540e9ae943b5e8fefc605fdd44d1b5 (patch) | |
| tree | 9beec872ddd1ee8bdc1b349f470ee229c2aadc98 /scripts/theme-studio/app.js | |
| parent | 2458ebd7f7df77b0ee6cee447bc391ac6adef5cc (diff) | |
| download | dotemacs-0682b24f27540e9ae943b5e8fefc605fdd44d1b5.tar.gz dotemacs-0682b24f27540e9ae943b5e8fefc605fdd44d1b5.zip | |
feat(theme-studio): realistic README preview for markdown-mode
markdown-mode fell back to the generic preview (bare face names). I added renderMarkdownPreview, a realistic README that exercises the markdown faces in context: front matter, headers, bold/italic, inline and fenced code, links, lists and checkboxes, a blockquote with a footnote, a table, strikethrough, highlight, math, and inline HTML. A PREVIEW_KEYS map in app_inventory routes markdown-mode to the renderer, and the #mdtest gate checks every data-face it emits is a real markdown face.
Diffstat (limited to 'scripts/theme-studio/app.js')
| -rw-r--r-- | scripts/theme-studio/app.js | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/scripts/theme-studio/app.js b/scripts/theme-studio/app.js index f2c322aaf..e0344ea36 100644 --- a/scripts/theme-studio/app.js +++ b/scripts/theme-studio/app.js @@ -955,8 +955,47 @@ function renderAutodimPreview(){ +pane('auto-dim',dimBody,dimBg,false) +`</div>`; } +function renderMarkdownPreview(){const a='markdown-mode',L=[]; + const dl='markdown-header-delimiter-face',mk='markdown-markup-face'; + L.push(os(a,mk,'---')); + L.push(os(a,'markdown-metadata-key-face','title:')+' '+os(a,'markdown-metadata-value-face','Project Name')); + L.push(os(a,'markdown-metadata-key-face','version:')+' '+os(a,'markdown-metadata-value-face','1.2.0')); + L.push(os(a,mk,'---')); + L.push(''); + L.push(os(a,dl,'#')+' '+os(a,'markdown-header-face-1','Project Name')); + L.push(''); + L.push(os(a,'markdown-comment-face','<!-- a one-line tagline -->')); + L.push('A library for '+os(a,'markdown-bold-face','**doing things**')+' and '+os(a,'markdown-italic-face','*other things*')+'.'); + L.push(''); + L.push(os(a,dl,'##')+' '+os(a,'markdown-header-face-2','Installation')); + L.push(''); + L.push('Run '+os(a,'markdown-inline-code-face','`npm install project`')+' to get started.'); + L.push(''); + L.push(os(a,mk,'```')+os(a,'markdown-language-keyword-face','sh')); + L.push(os(a,'markdown-pre-face',' git clone https://example.com/project.git')); + L.push(os(a,'markdown-pre-face',' cd project; make')); + L.push(os(a,mk,'```')); + L.push(''); + L.push(os(a,dl,'###')+' '+os(a,'markdown-header-face-3','Usage')); + L.push(''); + L.push(os(a,'markdown-list-face','- ')+'See the '+os(a,'markdown-link-face','[docs]')+os(a,'markdown-url-face','(https://example.com/docs)')+' for details.'); + L.push(os(a,'markdown-list-face','- ')+'Or browse '+os(a,'markdown-plain-url-face','https://example.com')+' directly.'); + L.push(os(a,'markdown-gfm-checkbox-face','- [x]')+' shipped '+os(a,'markdown-gfm-checkbox-face','- [ ]')+' planned'); + L.push(''); + L.push(os(a,'markdown-blockquote-face','> A note worth quoting, with a footnote')+os(a,'markdown-footnote-marker-face','[^1]')+os(a,'markdown-blockquote-face','.')); + L.push(''); + L.push(os(a,'markdown-table-face','| Option | Default |')); + L.push(os(a,'markdown-table-face','|--------|---------|')); + L.push(os(a,'markdown-table-face','| debug | false |')); + L.push(''); + L.push(os(a,'markdown-hr-face','---')); + L.push(''); + L.push(os(a,'markdown-strike-through-face','~~deprecated~~')+' '+os(a,'markdown-highlight-face','==important==')+' '+os(a,'markdown-math-face','$E = mc^2$')); + L.push(os(a,'markdown-html-tag-delimiter-face','<')+os(a,'markdown-html-tag-name-face','kbd')+os(a,'markdown-html-tag-delimiter-face','>')+'Ctrl-C'+os(a,'markdown-html-tag-delimiter-face','</')+os(a,'markdown-html-tag-name-face','kbd')+os(a,'markdown-html-tag-delimiter-face','>')); + L.push(os(a,'markdown-footnote-marker-face','[^1]:')+' '+os(a,'markdown-footnote-text-face','the footnote text.')); + return previewLines(L);} const PACKAGE_PREVIEWS={ - autodim:renderAutodimPreview, + autodim:renderAutodimPreview,markdown:renderMarkdownPreview, org:renderOrgPreview,magit:renderMagitPreview,elfeed:renderElfeedPreview,ghostel:renderGhostelPreview, dashboard:renderDashboardPreview,mu4e:renderMu4ePreview,orgfaces:renderOrgFacesPreview,lsp:renderLspPreview,gitgutter:renderGitGutterPreview, flycheck:renderFlycheckPreview,dired:renderDiredPreview,dirvish:renderDirvishPreview,calibredb:renderCalibredbPreview, |
