Documents: the field highlighter reads front matter as front matter
Without the front matter construct, an open front matter block parsed as a rule and a setext heading, so its keys drew bright and bold. The highlighter now parses as the file does. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
1ff993dcb1
commit
962964e7da
2 files changed
+8
-1
No files matched your search
@@ -186,3 +186,10 @@ fn open_code_math_and_front_matter_keep_their_panel(cx: &mut TestAppContext) {
|
|||||||
let front = styled(TargetBlock::FrontMatter, cx).text;
|
let front = styled(TargetBlock::FrontMatter, cx).text;
|
||||||
assert_eq!((front.color, front.font_family), (Some(muted), Some(mono)));
|
assert_eq!((front.color, front.font_family), (Some(muted), Some(mono)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[gpui::test]
|
||||||
|
fn open_front_matter_has_no_runs(cx: &mut TestAppContext) {
|
||||||
|
cx.update(crate::init_for_tests);
|
||||||
|
let runs = cx.update(|cx| markdown_highlights("---\ntitle: R75\n---", cx));
|
||||||
|
assert!(runs.is_empty(), "{runs:?}");
|
||||||
|
}
|
||||||
@@ -83,7 +83,7 @@ pub(crate) fn walk<'a>(node: &'a mdast::Node, out: &mut Vec<&'a mdast::Node>) {
|
|||||||
|
|
||||||
/// The marks over `text`, with the syntax writing each.
|
/// The marks over `text`, with the syntax writing each.
|
||||||
pub fn marks(text: &str) -> Vec<(Range<usize>, Mark)> {
|
pub fn marks(text: &str) -> Vec<(Range<usize>, Mark)> {
|
||||||
let root = tree(text);
|
let root = file_tree(text);
|
||||||
let mut nodes = Vec::new();
|
let mut nodes = Vec::new();
|
||||||
walk(&root, &mut nodes);
|
walk(&root, &mut nodes);
|
||||||
let mut out = Vec::new();
|
let mut out = Vec::new();
|
||||||
|
|||||||
Reference in new issue
Block a user