From bda6e53bcbae9534d1ca0b7e09c770b3d194f829 Mon Sep 17 00:00:00 2001 From: Kai Schmidt Date: Mon, 6 Jan 2025 13:02:22 -0800 Subject: [PATCH] workaround parsing backticks in markdown code blocks --- site/src/markdown.rs | 10 +++++++--- site/text/design.md | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/site/src/markdown.rs b/site/src/markdown.rs index f9777c22a..e871faf2d 100644 --- a/site/src/markdown.rs +++ b/site/src/markdown.rs @@ -98,9 +98,13 @@ fn node_view<'a>(node: &'a AstNode<'a>) -> View { NodeValue::Item(_) => view!(
  • {children}
  • ).into_view(), NodeValue::Paragraph => view!(

    {children}

    ).into_view(), NodeValue::Code(code) => { + let mut lit = code.literal.clone(); + if lit.contains("") { + lit = lit.replace("", "`"); + } let mut inputs = Inputs::default(); - let (tokens, errors, _) = uiua::lex(&code.literal, (), &mut inputs); - if errors.is_empty() && code.literal != "---" { + let (tokens, errors, _) = uiua::lex(&lit, (), &mut inputs); + if errors.is_empty() && lit != "---" { let mut frags = Vec::new(); for token in tokens { let text = token.span.as_str(&inputs, |s| s.to_string()); @@ -112,7 +116,7 @@ fn node_view<'a>(node: &'a AstNode<'a>) -> View { frags.push(view!().into_view()) } _ => { - frags = vec![view!({code.literal.clone()}).into_view()]; + frags = vec![view!({lit.clone()}).into_view()]; break; } } diff --git a/site/text/design.md b/site/text/design.md index 15d068c88..2290a4858 100644 --- a/site/text/design.md +++ b/site/text/design.md @@ -19,7 +19,7 @@ As more and more Uiua code was written, I developed the principle of [Stack-Sour Long tacit expressions in most array languages can get very unwieldy. Because binary operations are infix, you have to parse the tree structure in your head before you can start determining the order of operations. -For example, in BQN, you can trim matches from the beginning of a string with [`x(∧`∘∊˜¬⊸/⊢)y`](https://mlochbaum.github.io/bqncrate/?q=Remove%20cells%20that%20appear%20in%20x%20from%20beginning%20of%20y#). +For example, in BQN, you can trim matches from the beginning of a string with [`x(∧∘∊˜¬⊸/⊢)y`](https://mlochbaum.github.io/bqncrate/?q=Remove%20cells%20that%20appear%20in%20x%20from%20beginning%20of%20y#). In contrast, here is their equivalent in Uiua, implemented the same way: