Skip to main content

BUILTIN_BASE_CSS

Constant BUILTIN_BASE_CSS 

Source
pub const BUILTIN_BASE_CSS: &str = "/* Base styles for all themes\n * This file is always loaded first, themes override these defaults.\n *\n * Note: No .content wrapper is used. Styles are applied directly to elements\n * so that css-inline can inline them without a wrapper div. This is required\n * for platforms like WeChat that filter out <div> tags.\n */\n\n/* ============================================================================\n * Base typography\n * ============================================================================ */\n\nhtml,\nbody {\n  margin: 0;\n  padding: 0;\n}\n\nh1,\nh2,\nh3,\nh4,\nh5,\nh6,\np,\nul,\nol,\nblockquote,\npre,\ntable,\nhr,\nfigcaption,\nli,\nth,\ntd {\n  font-family:\n    -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Noto Sans\", \"PingFang SC\",\n    \"Microsoft YaHei\", sans-serif;\n  color: #2f343b;\n  letter-spacing: 0.015em;\n}\n\n/* ============================================================================\n * Headings\n * ============================================================================ */\n\nh1,\nh2,\nh3,\nh4,\nh5,\nh6 {\n  margin-top: 1.85em;\n  margin-bottom: 0.6em;\n  font-weight: 650;\n  line-height: 1.35;\n}\n\nh1:first-child,\nh2:first-child,\nh3:first-child,\nh4:first-child,\nh5:first-child,\nh6:first-child {\n  margin-top: 0.2em;\n}\n\nh1 {\n  font-size: 1.92em;\n  letter-spacing: 0.01em;\n}\n\nh2 {\n  font-size: 1.58em;\n}\n\nh3 {\n  font-size: 1.3em;\n}\n\nh4 {\n  font-size: 1.12em;\n}\n\nh5 {\n  font-size: 1em;\n}\n\nh6 {\n  font-size: 0.92em;\n  color: #626b79;\n}\n\n/* ============================================================================\n * Paragraphs and lists\n * ============================================================================ */\n\np {\n  margin: 0.95em 0;\n  line-height: 1.84;\n}\n\nul,\nol {\n  padding-left: 1.65em;\n  margin: 0.95em 0;\n  line-height: 1.78;\n}\n\nli {\n  margin: 0.4em 0;\n}\n\nli > ul,\nli > ol {\n  margin-top: 0.45em;\n  margin-bottom: 0.45em;\n}\n\nul {\n  list-style-type: disc;\n}\n\nul ul {\n  list-style-type: circle;\n}\n\nul ul ul {\n  list-style-type: square;\n}\n\nul li.task-item {\n  list-style: none;\n  position: relative;\n  padding-left: -1.5em;\n}\n\nul li.task-item::marker {\n  display: none;\n}\n\n/* ============================================================================\n * Blockquotes\n * ============================================================================ */\n\nblockquote {\n  margin: 1.15em 0;\n  padding: 0.75em 1.05em;\n  border-left: 3px solid #ccd5e1;\n  border-radius: 0 8px 8px 0;\n  background: #f7f9fc;\n  line-height: 1.78;\n}\n\nblockquote p {\n  margin: 0.45em 0;\n  color: #4c5563;\n}\n\n/* ============================================================================\n * Code blocks and inline code\n * ============================================================================ */\n\npre {\n  background: #f7f8fb;\n  border: 1px solid #e3e8f0;\n  border-radius: 8px;\n  overflow-x: auto;\n  margin: 1.1em 0;\n  padding: 1.05em 1.15em;\n}\n\ncode {\n  font-family:\n    \"SFMono-Regular\", ui-monospace, Consolas, \"Liberation Mono\", Menlo,\n    \"Courier New\", monospace;\n  font-size: 0.89em;\n}\n\np code,\nli code {\n  background: #f1f4f8;\n  border: 1px solid #e1e7ef;\n  color: #2e3b4f;\n  border-radius: 4px;\n  padding: 0.16em 0.4em;\n}\n\n/* ============================================================================\n * Tables\n * ============================================================================ */\n\ntable {\n  border-collapse: collapse;\n  width: 100%;\n  margin: 1.1em 0;\n  line-height: 1.7;\n  font-size: 0.96em;\n}\n\nth,\ntd {\n  border: 1px solid #d7deea;\n  padding: 0.56em 0.9em;\n  text-align: left;\n}\n\nth {\n  background: #f4f7fb;\n  font-weight: 650;\n}\n\n/* ============================================================================\n * Images and figures\n * ============================================================================ */\n\nimg {\n  max-width: 100%;\n  height: auto;\n  margin: 1.15em 0;\n  border-radius: 8px;\n}\n\nfigure {\n  margin: 0;\n  text-align: center;\n  width: 100%;\n}\n\nfigure > img {\n  display: block;\n  margin-left: auto;\n  margin-right: auto;\n}\n\nfigcaption {\n  text-align: center;\n  color: #6d7683;\n  font-size: 0.88em;\n  margin-top: 0.55em;\n  line-height: 1.45;\n}\n\n/* ============================================================================\n * Links\n * ============================================================================ */\n\na {\n  color: #0b67c2;\n  text-decoration: underline;\n  text-decoration-thickness: 1px;\n  text-decoration-color: rgba(11, 103, 194, 0.4);\n  text-underline-offset: 0.13em;\n}\n\na:hover {\n  color: #084f97;\n  text-decoration-color: rgba(8, 79, 151, 0.75);\n}\n\n/* ============================================================================\n * Text formatting\n * ============================================================================ */\n\nstrong {\n  font-weight: 700;\n}\n\nem {\n  font-style: italic;\n}\n\ndel {\n  text-decoration: line-through;\n  color: #8f98a5;\n}\n\n/* ============================================================================\n * Horizontal rule\n * ============================================================================ */\n\nhr {\n  border: none;\n  height: 1px;\n  background: linear-gradient(\n    to right,\n    rgba(145, 157, 178, 0),\n    rgba(145, 157, 178, 0.55),\n    rgba(145, 157, 178, 0)\n  );\n  margin: 2.2em 0;\n}\n\n/* ============================================================================\n * SVG math equations\n * ============================================================================ */\n\n/* Inline SVG (inline math): display inline with text baseline */\n.typst-svg-inline {\n  display: inline;\n}\n\n.typst-svg-inline svg {\n  display: inline;\n}\n\n/* Block SVG (block math): center with margin */\n.typst-svg-block {\n  display: block;\n  margin: 1em 0;\n}\n\n.typst-svg-block svg {\n  display: block;\n  margin: 0 auto;\n  max-width: 100%;\n}\n\n/* ============================================================================\n * Admonitions / Callouts\n * ============================================================================ */\n\n.admonition {\n  margin: 1em 0;\n  padding: 0.75em 1em;\n  border-left: 4px solid #c6d0df;\n  background: #f7f9fc;\n  border-radius: 6px;\n  line-height: 1.68;\n}\n\n.admonition p {\n  margin: 0.5em 0;\n}\n\n.admonition-title {\n  font-weight: 650;\n  margin-bottom: 0.5em;\n  padding-bottom: 0.5em;\n  border-bottom: 1px solid rgba(0, 0, 0, 0.09);\n}\n\n/* Note */\n.admonition.note {\n  border-left-color: #2f77d0;\n  background: #f2f7ff;\n}\n\n/* Tip */\n.admonition.tip {\n  border-left-color: #2f9856;\n  background: #f1fbf4;\n}\n\n/* Warning */\n.admonition.warning {\n  border-left-color: #d69a21;\n  background: #fff9ef;\n}\n\n/* Danger */\n.admonition.danger {\n  border-left-color: #d1495b;\n  background: #fff4f5;\n}\n\n/* Info */\n.admonition.info {\n  border-left-color: #2f91a8;\n  background: #f1fbff;\n}\n\n/* Reset blockquote styles when used for admonitions (WeChat/Weibo compatibility)\n * These need higher specificity to override the base blockquote rules.\n */\nblockquote.admonition {\n  margin: 1em 0;\n  padding: 0.75em 1em;\n  border-left: 4px solid #c6d0df;\n  background: #f7f9fc;\n  border-radius: 6px;\n  line-height: 1.68;\n}\n\nblockquote.admonition p {\n  margin: 0.5em 0;\n}\n\nblockquote.admonition.note {\n  border-left-color: #2f77d0;\n  background: #f2f7ff;\n}\n\nblockquote.admonition.tip {\n  border-left-color: #2f9856;\n  background: #f1fbf4;\n}\n\nblockquote.admonition.warning {\n  border-left-color: #d69a21;\n  background: #fff9ef;\n}\n\nblockquote.admonition.danger {\n  border-left-color: #d1495b;\n  background: #fff4f5;\n}\n\nblockquote.admonition.info {\n  border-left-color: #2f91a8;\n  background: #f1fbff;\n}\n";
Expand description

Base CSS applied to all themes.