fix(prose): Decl names are identifiers; skip non-decl tick spans
Reject `` `n+1` `` as Decl, and when skipping non-decl `` `…` `` advance past the closing tick so inner `*` cannot open italic (fixes `` `OPENAI_*` `` in ext/ai/llm). Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
c8f41164c5
commit
114fd53cd1
5 files changed
+67
-3
No files matched your search
+12
-1
@@ -90,7 +90,7 @@ fn looks_like_backtick_assign(trimmed: &str) -> bool {
|
||||
return false;
|
||||
};
|
||||
let name = &rest[..end];
|
||||
if name.is_empty() || name.chars().any(|c| c.is_whitespace()) {
|
||||
if name.is_empty() || !is_backtick_bind_name(name) {
|
||||
return false;
|
||||
}
|
||||
let after_tick = &rest[end + 1..];
|
||||
@@ -115,6 +115,17 @@ fn looks_like_backtick_assign(trimmed: &str) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn is_backtick_bind_name(name: &str) -> bool {
|
||||
let mut chars = name.chars();
|
||||
let Some(first) = chars.next() else {
|
||||
return false;
|
||||
};
|
||||
if !(first.is_alphabetic() || first == '_' || !first.is_ascii()) {
|
||||
return false;
|
||||
}
|
||||
chars.all(|c| c.is_alphanumeric() || c == '_' || !c.is_ascii())
|
||||
}
|
||||
|
||||
/// `*` / `**` lines that are Marqdo executable (statement / return / else), not narrative Markdown.
|
||||
///
|
||||
/// Closing `*` / `**` must not be taken from inside `` `…` `` or `"…"` (GAP-06/07 nested markers).
|
||||
|
||||
Reference in new issue
Block a user