aboutsummaryrefslogtreecommitdiff
path: root/dev_tools
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-06-30 07:06:07 +0800
committer魏曹先生 <1992414357@qq.com>2026-06-30 07:06:07 +0800
commit793e6b538c95c54c647f7127d634818547028999 (patch)
tree6e7b0e0b85a208751116015b0c3e531ec928321d /dev_tools
parent2aa0de3852611aed2823fd40a3f6f47b8f50f0cd (diff)
feat(docs): add @@@ hidden code block support for compile-tested
examples
Diffstat (limited to 'dev_tools')
-rw-r--r--dev_tools/src/verify.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/dev_tools/src/verify.rs b/dev_tools/src/verify.rs
index 36283d3..2ddff0c 100644
--- a/dev_tools/src/verify.rs
+++ b/dev_tools/src/verify.rs
@@ -73,6 +73,24 @@ fn parse_single_block(lines: &[&str], start: usize, source_file: &str) -> Option
break;
}
+ // @@@ lines: strip the prefix and treat as regular Rust code
+ // These lines are hidden in the rendered docs (filtered by a docsify plugin)
+ // but must still compile.
+ if trimmed.starts_with("@@@") {
+ in_header = false;
+ // Strip @@@ and optionally one following space
+ let code = trimmed[3..].trim_start();
+ if code.contains("fn main") {
+ has_main = true;
+ }
+ if code.contains("gen_program!") {
+ has_gen_program = true;
+ }
+ code_lines.push(code.to_string());
+ idx += 1;
+ continue;
+ }
+
// Parse header comments
// Check for NOT VERIFIED marker
if in_header && trimmed == "// NOT VERIFIED" {