mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-12 13:38:31 +09:00
fix(markdown): only open code fences at line start (#2081)
This commit is contained in:
1 parent
82941c08c9
commit
34eb10cd88
3 files changed
+25
-61
No files matched your search
@@ -172,3 +172,27 @@ fn single_line_fence_without_space_is_content() {
|
||||
json!([{"type":"CodeBlock","content":"hello"}])
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn mid_line_fence_is_literal_text() {
|
||||
assert_eq!(
|
||||
parse("note text```rust\nfn main() {}\n```"),
|
||||
json!([{"type":"Text","content":"note text```rust\nfn main() {}\n```"}])
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn mid_line_fence_spanning_multiple_lines_stays_text() {
|
||||
assert_eq!(
|
||||
parse("intro line ```js\nbody one\nbody two\n```"),
|
||||
json!([{"type":"Text","content":"intro line ```js\nbody one\nbody two\n```"}])
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn line_start_fence_still_opens_code_block() {
|
||||
assert_eq!(
|
||||
parse("```rust\nfn main() {}\n```"),
|
||||
json!([{"type":"CodeBlock","language":"rust","content":"fn main() {}\n"}])
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user