feat(PR-02): DocumentModel, Analysis v2 projection, single renderer and Live browsing

- document.rs: comrak marqdo.md.v1 parse -> DocBlock/Inline with exact UTF-8 spans
- semantic.rs: typed Analysis v2 validation (schema/profile/root_id/source_digest,
  units/functions/statements/resources/imports/references/calls/diagnostics,
  per-span UTF-8 checks with explicit view.source_span_invalid warnings)
- presentation.rs: one PresentationModel/Outline with source status matrix
- render.rs: one ReaderRenderer; sanitized GFM, statement anchors, heading mode
  badges (display-only prefix strip), source pane, docs/Live|Static link policy,
  CSP meta, no inline scripts, no raw HTML execution
- server.rs: loopback-only Live reader with Host/DNS-rebinding checks, strict
  percent decoding, project path boundary, security headers, read-only APIs
- app.rs: AppContext degradation (core missing -> prose-only, check error ->
  diagnostics + revoked semantics, protocol mismatch -> hard error)
- assets: single reader.css/reader.js + embedded SHA-256 AssetBundle, copied
  legacy logo/blossom/feather with provenance
- examples + frozen-CLI Analysis goldens + rendering/HTTP/asset/no-coupling tests
- ADR-0003 heading prefix/anchor identity; docs updated
This commit is contained in:
marqdo-view dev committed 2026-11-22 11:19:11 +08:00
1 parent 8ba20a5c67
commit 80ce564f09
47 files changed
+26127 -203

No files matched your search

+27
View File
@@ -0,0 +1,27 @@
# @knowledge 控制流演示
下面的函数没有任何必需参数,因此可以在 `pure` 模式下显式运行并产生真实 Trace。
# @exec 演示
## @exec main
`x = 0`
**while x < 3**
**if x > 1**
**print(x)**
**else**
**print(0)**
**end**
**x = x + 1**
**end**
`return 3`
+3
View File
@@ -0,0 +1,3 @@
project:
name: control-flow
version: 0.1.0
+11
View File
@@ -0,0 +1,11 @@
# @knowledge 诊断演示
这份源码故意不合法:`if` 没有在同一个标题段落内闭合,Core `check` 会给出诊断。
# @exec 演示
## @exec main
**if x > 0**
`return 1`
+3
View File
@@ -0,0 +1,3 @@
project:
name: diagnostics-demo
version: 0.1.0
+31
View File
@@ -0,0 +1,31 @@
# @knowledge 计算笔记
这是一份关于简单运算的知识说明。**此处加粗是知识内容,不执行。**
## @knowledge 算法说明
下面描述算法的含义和适用范围;此处的 `n` 是惰性正文。
# @exec 演示
## @exec main
`params(n: Int)`
### @knowledge 用法
调用方提供整数 `n`。这一小节不应该执行任何语句。
### @exec 计算
**if n > 0**
`result = n * 2`
*return result*
**else**
`return 0`
**end**
+3
View File
@@ -0,0 +1,3 @@
project:
name: mixed-modes
version: 0.1.0
+21
View File
@@ -0,0 +1,21 @@
# @knowledge 表格、公式与惰性资源
| 名称 | 值 | 说明 |
| --- | ---: | --- |
| 甲 | 1 | 第一行 |
| 乙 | 2 | 第二行 |
行内公式 $E = mc^2$;块公式:
$$
\sum_{i=1}^{n} i = \frac{n(n+1)}{2}
$$
```python
print("代码围栏永远是惰性资源")
```
- [x] 任务列表可读
- [ ] 不会触发任何执行
外部链接:[Marqdo CLI](https://github.com/cflmy/marqdo-cli)。
+3
View File
@@ -0,0 +1,3 @@
project:
name: tables-math
version: 0.1.0
+15
View File
@@ -0,0 +1,15 @@
# @knowledge 欢迎来到 Marqdo
Marqdo 把 Markdown 当作可执行文档的语言:标题声明 `@exec` / `@knowledge` 模式,
强调、斜体与行内代码是**等价的单语句载体**,而 `if` / `else` / `while` / `end` /
`return` 决定真正的操作。
| 阅读态 | 内容 | 是否执行 |
| --- | --- | --- |
| 文档 | 原始 Markdown 排版 | 否 |
| 源码 | 逐行原文,包含全部标记 | 否 |
| 运行 | 用户显式确认后才出现 | 是(需要确认) |
继续阅读:[语法演示](./guide.mq.md)。
> 这份欢迎页只是 `view.json` 显式指定的站点首页,普通 `welcome` 文件名不会自动变成 Hero。
+17
View File
@@ -0,0 +1,17 @@
# @knowledge 阅读指南
## @knowledge 三种视图
文档态是默认视图;源码态保留原文字节;运行态只在用户点击“运行”并确认后出现。
## @knowledge 公式与代码
行内公式 $a^2 + b^2 = c^2$ 是惰性资源;围栏代码同样从不自动执行:
```rust
fn main() {
println!("这段代码只是文档内容");
}
```
回到[欢迎页](./00-welcome.mq.md)。
+3
View File
@@ -0,0 +1,3 @@
project:
name: welcome-demo
version: 0.1.0
+7
View File
@@ -0,0 +1,7 @@
{
"schema": "marqdo.view-config",
"schema_version": 1,
"welcome": "./00-welcome.mq.md",
"site_title": "Marqdo",
"theme": "botanical"
}