Small fixes

This commit is contained in:
Laurenz 2023-01-23 16:01:15 +01:00
parent 4653ffebb4
commit 33585d9a3f
7 changed files with 13 additions and 2 deletions

1
Cargo.lock generated
View File

@ -1094,6 +1094,7 @@ dependencies = [
"flate2", "flate2",
"if_chain", "if_chain",
"image", "image",
"log",
"miniz_oxide 0.5.4", "miniz_oxide 0.5.4",
"once_cell", "once_cell",
"pdf-writer", "pdf-writer",

View File

@ -19,6 +19,7 @@ comemo = { git = "https://github.com/typst/comemo" }
flate2 = "1" flate2 = "1"
if_chain = "1" if_chain = "1"
image = { version = "0.24", default-features = false, features = ["png", "jpeg", "gif"] } image = { version = "0.24", default-features = false, features = ["png", "jpeg", "gif"] }
log = "0.4"
miniz_oxide = "0.5" miniz_oxide = "0.5"
once_cell = "1" once_cell = "1"
pdf-writer = "0.6" pdf-writer = "0.6"

View File

@ -31,7 +31,7 @@ impl VecNode {
/// ///
/// # Example /// # Example
/// ``` /// ```
/// #set vec(delim: "[") /// #set math.vec(delim: "[")
/// $ vec(1, 2) $ /// $ vec(1, 2) $
/// ``` /// ```
pub const DELIM: Delimiter = Delimiter::Paren; pub const DELIM: Delimiter = Delimiter::Paren;

View File

@ -56,6 +56,7 @@ pub fn module() -> Module {
math.def_func::<FloorFunc>("floor"); math.def_func::<FloorFunc>("floor");
math.def_func::<CeilFunc>("ceil"); math.def_func::<CeilFunc>("ceil");
math.def_func::<AbsFunc>("abs"); math.def_func::<AbsFunc>("abs");
math.def_func::<NormFunc>("norm");
math.def_func::<AccentNode>("accent"); math.def_func::<AccentNode>("accent");
math.def_func::<FracNode>("frac"); math.def_func::<FracNode>("frac");
math.def_func::<BinomNode>("binom"); math.def_func::<BinomNode>("binom");

View File

@ -37,7 +37,7 @@ impl LayoutMath for SqrtNode {
/// ///
/// ## Example /// ## Example
/// ``` /// ```
/// $ radical(3, x) $ /// $ root(3, x) $
/// ``` /// ```
/// ///
/// ## Parameters /// ## Parameters

View File

@ -191,6 +191,13 @@ pub fn highlight(node: &LinkedNode) -> Option<Category> {
| SyntaxKind::Frac, | SyntaxKind::Frac,
) => Some(Category::Interpolated), ) => Some(Category::Interpolated),
Some(SyntaxKind::FuncCall) => Some(Category::Function), Some(SyntaxKind::FuncCall) => Some(Category::Function),
Some(SyntaxKind::FieldAccess)
if node.parent().and_then(|p| p.parent_kind())
== Some(SyntaxKind::SetRule)
&& node.next_sibling().is_none() =>
{
Some(Category::Function)
}
Some(SyntaxKind::FieldAccess) Some(SyntaxKind::FieldAccess)
if node if node
.parent() .parent()

View File

@ -429,6 +429,7 @@ impl Lexer<'_> {
'-' if self.s.eat_if('>') => SyntaxKind::Shorthand, '-' if self.s.eat_if('>') => SyntaxKind::Shorthand,
'=' if self.s.eat_if('>') => SyntaxKind::Shorthand, '=' if self.s.eat_if('>') => SyntaxKind::Shorthand,
':' if self.s.eat_if('=') => SyntaxKind::Shorthand, ':' if self.s.eat_if('=') => SyntaxKind::Shorthand,
'.' if self.s.eat_if("..") => SyntaxKind::Shorthand,
'_' => SyntaxKind::Underscore, '_' => SyntaxKind::Underscore,
'$' => SyntaxKind::Dollar, '$' => SyntaxKind::Dollar,