@deot/docs-markdown 1.0.10 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -27,19 +27,24 @@ const source = ref('# Hello @deot/docs');
27
27
 
28
28
  组件接受 `modelValue` 或 `value` 字符串。当前组件负责渲染,不会修改传入的 Markdown 内容。
29
29
  `locale` 可显式传入 `Language`;未传入时优先使用上层 `provideLocale()`,否则回退到 `en-US`。
30
+ `theme` 控制排版皮肤(`'default' | 'traditional'`),与站点 light/dark 正交。
31
+ `playground` 可传入站点级 Playground 默认 props;`:::playground` 块内 JSON5 配置会浅合并覆盖这些默认值。
30
32
 
31
33
  ## 文档指示器
32
34
 
33
- 指示器默认开启。它会把标题、段落、列表、代码块等文档块压缩成纵向刻度,支持悬停预览、点击定位和拖动浏览:
35
+ 指示器默认开启。它是贴在正文一侧的**小地图**(空间 scrubber),不是第二份目录:刻度与文档壳大纲使用同一份标题(有章节标题时不含页面 h1),按标题在正文中的纵向比例铺在固定高度条上,并用可视窗口标出当前主滚动范围。支持悬停预览、点击定位和拖动浏览,**只滚动、不改 hash**。章节名称导航仍由文档壳右侧大纲负责。
36
+
37
+ 定位与文档壳大纲一致:`sticky` 贴顶,高度按正文与主滚动可视区域封顶,轨道上下 padding 为 `40px / 96px`。
34
38
 
35
39
  ```vue
36
40
  <Markdown
37
41
  :value="source"
38
42
  :indicator="{
39
- position: 'right',
43
+ position: 'left',
40
44
  preview: true,
41
45
  draggable: true,
42
- height: 'min(72vh, 600px)'
46
+ top: 0,
47
+ height: 480
43
48
  }"
44
49
  />
45
50
  ```
@@ -49,10 +54,10 @@ const source = ref('# Hello @deot/docs');
49
54
  | 参数 | 类型 | 默认值 | 说明 |
50
55
  | --- | --- | --- | --- |
51
56
  | `preview` | `boolean` | `true` | 是否展示悬停摘要。 |
52
- | `draggable` | `boolean` | `true` | 是否允许拖动快速浏览。 |
53
- | `position` | `'left' \| 'right'` | `'right'` | 指示器所在侧。 |
54
- | `top` | `number \| string` | `0` | 相对滚动容器垂直中心的偏移,默认上下居中。 |
55
- | `height` | `number \| string` | `min(72vh, 600px)` | 指示器的可视高度。 |
57
+ | `draggable` | `boolean` | `true` | 是否允许拖动快速浏览。关闭后仍可点击轨道定位。 |
58
+ | `position` | `'left' \| 'right'` | `'left'` | 指示器所在侧。文档壳中有斜纹轨时靠近 `rail--start` 右侧或 `rail--end` 左侧,并留 8px 间距。 |
59
+ | `top` | `number \| string` | `0` | sticky 贴顶偏移,数字按 px 处理。 |
60
+ | `height` | `number \| string` | 按正文/视口封顶 | 小地图总高度(含上下 padding)。数字会与封顶值取较小值;未配置时使用封顶后的 px。 |
56
61
 
57
62
  ## Markdown 扩展
58
63
 
@@ -90,6 +95,7 @@ const source = ref('# Hello @deot/docs');
90
95
  <config lang="json5">
91
96
  {
92
97
  entry: 'main.js',
98
+ title: '多文件示例',
93
99
  views: ['runtime', 'files'],
94
100
  viewport: 375,
95
101
  viewportOptions: ['auto', 375, [375, 667]]
@@ -111,7 +117,8 @@ createApp(App).mount('#app');
111
117
  ````
112
118
 
113
119
  支持的 `views` 值为 `runtime` 和 `files`。`viewport` 可为 `auto`、正数宽度或 `[width, height]`。
114
- `expand` 为可选:`true` 展开到剩余视口,正数为展开目标高度(px);未配置时不显示展开控件。
120
+ `title` 为可选字符串,显示在运行时顶栏左侧;空串或不传不渲染。有标题时会生成锚点 id(可用 `#...` 跳转),规则与 markdown heading 一致;也可用 `id` 显式覆盖。
121
+ `expandable` 为可选:`true` 展开到剩余视口,正数为展开目标高度(px);未配置时不显示展开控件。
115
122
 
116
123
  Playground 会在浏览器里编译 Vue SFC 的 `<style lang="scss">` 以及独立 `.scss` / `.sass` 文件。下划线 partial(如 `_variables.scss`)只作为 `@use` 依赖,不会单独注入预览。
117
124