Add foreign stdlib with code values and ship v0.0.4.
Bind `lang fences like formulas, run them via local interpreters, polish live-view code cards, and refresh bilingual welcome docs. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
dcd0cdb8f7
commit
b5e9d15391
33 files changed
+1044
-199
No files matched your search
@@ -73,6 +73,7 @@ pub fn classify_source(source: &str) -> Vec<ClassifiedLine> {
|
||||
let mut out = Vec::with_capacity(lines.len());
|
||||
let mut in_comment_paragraph = false;
|
||||
let mut in_math_fence = false;
|
||||
let mut in_md_fence = false;
|
||||
|
||||
for (i, text) in lines.into_iter().enumerate() {
|
||||
let base = classify_line(text);
|
||||
@@ -83,6 +84,16 @@ pub fn classify_source(source: &str) -> Vec<ClassifiedLine> {
|
||||
in_math_fence = false;
|
||||
}
|
||||
LineKind::Code
|
||||
} else if in_md_fence {
|
||||
// Markdown ``` fences are narrative / foreign sources — not Marqdo stmts.
|
||||
if is_md_fence_line(trimmed) {
|
||||
in_md_fence = false;
|
||||
}
|
||||
LineKind::Comment
|
||||
} else if is_md_fence_opener(trimmed) {
|
||||
in_md_fence = true;
|
||||
in_comment_paragraph = false;
|
||||
LineKind::Comment
|
||||
} else {
|
||||
match base {
|
||||
LineKind::Blank => {
|
||||
@@ -116,6 +127,18 @@ pub fn classify_source(source: &str) -> Vec<ClassifiedLine> {
|
||||
out
|
||||
}
|
||||
|
||||
fn is_md_fence_opener(trimmed: &str) -> bool {
|
||||
trimmed.starts_with("```")
|
||||
&& !trimmed
|
||||
.chars()
|
||||
.skip_while(|c| *c == '`')
|
||||
.all(|c| c.is_whitespace())
|
||||
}
|
||||
|
||||
fn is_md_fence_line(trimmed: &str) -> bool {
|
||||
trimmed.starts_with("```")
|
||||
}
|
||||
|
||||
/// Function-end / frontmatter HR or empty bold return — never swallowed by paragraphs.
|
||||
fn is_structural_code_line(trimmed: &str) -> bool {
|
||||
if trimmed.len() >= 3
|
||||
|
||||
Reference in new issue
Block a user