Files
md-preview/assets/page/page.html
Richard Wu 1115052762 refactor: split the page, markdown pipeline and escaping out of main.rs
- assets/page/{page.html,page.css,page.js} now hold the UI. build_page only
  fills __MDP_*__ placeholders, so editing the page no longer means escaping
  braces inside a format! string. Output was verified byte-identical for the
  home page, a math/mermaid document and the startup page.
- src/markdown.rs: md -> html pipeline (GFM, AI-output dialect, front matter,
  embedded images, ==highlight==, heading ids).
- src/page.rs: page assembly.
- src/escape.rs: shared JS/HTML escaping.
- src/main.rs drops from 5535 to 3709 lines. No behavior change; 62 tests.
2026-11-03 23:02:58 +08:00

37 lines
2.1 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html><html><head><meta charset="utf-8">
__MDP_BASE_TAG__
<style id="hljs-code">__MDP_CSS_CODE__</style>
<style>
__MDP_PAGE_CSS__
</style></head><body class="__MDP_BODY_CLASS__">
<div class="tabbar" id="tabbar"><div class="tabs" id="tabs"></div><div class="doc-stats" id="doc-stats" aria-live="polite"></div><button class="tab-open" id="tab-open" type="button" title="__MDP_NEW_TAB__" aria-label="__MDP_NEW_TAB__">+</button></div>
<div class="tab-menu" id="tab-menu" hidden><div class="tab-menu-path" id="tab-menu-path"></div><button type="button" id="tab-menu-reveal">__MDP_BTN_OPEN_LOCATION__</button><button type="button" id="tab-menu-new-window">__MDP_BTN_NEW_WINDOW__</button></div>
<div class="toolbar">
<button id="btn-toggle" title="__MDP_BTN_EDIT__" aria-label="__MDP_BTN_EDIT__"></button>
<div class="zoom-control" id="zoom-control">
<button id="btn-zoom" title="__MDP_BTN_ZOOM__" aria-label="__MDP_BTN_ZOOM__"></button>
<div class="zoom-popover">
<button id="btn-zoom-out" title="__MDP_BTN_ZOOM_OUT__" aria-label="__MDP_BTN_ZOOM_OUT__">−</button>
<button id="btn-zoom-reset" class="zoom-reset" title="__MDP_BTN_ZOOM_RESET__" aria-label="__MDP_BTN_ZOOM_RESET__">100%</button>
<button id="btn-zoom-in" title="__MDP_BTN_ZOOM_IN__" aria-label="__MDP_BTN_ZOOM_IN__">+</button>
</div>
</div>
</div>
<div class="findbar" role="search">
<input id="find-input" type="search" placeholder="__MDP_SEARCH_PLACEHOLDER__" aria-label="__MDP_SEARCH_PLACEHOLDER__">
<span id="find-state"></span>
<button id="find-prev" title="Previous" aria-label="Previous"></button>
<button id="find-next" title="Next" aria-label="Next"></button>
<button id="find-close" title="Close" aria-label="Close"></button>
</div>
<div id="app">
<div id="preview">__MDP_PREVIEW_HTML__</div>
<textarea id="editor" spellcheck="false">__MDP_RAW_MD_ESCAPED__</textarea>
</div>
<script>
__MDP_PAGE_JS__
window.__mdPreviewFeatureFlags = { math: __MDP_NEEDS_MATH__, mermaid: __MDP_NEEDS_MERMAID__ };
__MDP_PREVIEW_ENHANCE_JS__
if(window.__enhancePreview)window.__enhancePreview();
</script>
</body></html>