mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 22:34:45 +00:00
Restore » in docs and allow it in highlighter
This commit is contained in:
parent
09c0453fc9
commit
e7c93bad75
2 changed files with 32 additions and 8 deletions
|
@ -18,6 +18,18 @@ pub fn highlight(code: &str) -> Vec<String> {
|
|||
let mut buf: Vec<String> = Vec::new();
|
||||
let mut offset = 0;
|
||||
|
||||
// Sometimes code snippets start with "»" in order to show that they're in the repl.
|
||||
// Special-case that even though it's normally not a valid highlight.
|
||||
const REPL_PROMPT: &str = "»";
|
||||
|
||||
let code = if code.starts_with(REPL_PROMPT) {
|
||||
buf = push_html_span(buf, REPL_PROMPT, "kw");
|
||||
|
||||
&code[REPL_PROMPT.len()..]
|
||||
} else {
|
||||
code
|
||||
};
|
||||
|
||||
for location in locations {
|
||||
let current_text = &code[offset..location.byte_range().end];
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue