It is more complex than it needs to be for most uses because it tries to be as feature-complete as possible.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#set list(indent: 2em) | |
#show list: li => block({ | |
for it in li.children { | |
let nesting = state("list-nesting", 0) | |
let indent = context h((nesting.get() + 1) * li.indent) | |
let marker = context { | |
let n = nesting.get() | |
li.marker.at(calc.rem(n, li.marker.len())) | |
} | |
let body = { |
Based on work from citation-style-language/styles. It is thus licensed under: CC BY-SA 3.0 Deed.
I created it as an answer to typst/typst#3293.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env nu | |
# Extract an archive using 7-Zip. | |
export def main [ | |
file: path | |
--output (-o): path | |
] { | |
let extension = $file | path parse | get extension | |
let compressor = match $extension { | |
bz2 | tb2 | tbz | tbz2 | tz2 => "bzip2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"luckyBangUrl": "https://kagi.com/search?q=!+%q", | |
"siteFormat": "site:%d", | |
"orOperator": "OR", | |
"bangPrefix": "!", | |
"luckyBang": "!", | |
"siteBangSep": "@", | |
"superLuckyBangPrefix": "!!", | |
"multiBangDelim": ";", | |
"multiSiteBangDelim": ",", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#let data = ( | |
books: ( | |
(title: "The Final Empire", author: "Brandon Sanderson"), | |
(title: "The Sword of Kaigen", author: "M.L. Wang"), | |
), | |
query: 0, | |
) | |
#faux-jsonpath(data, "$.books[0].author") | |
#faux-jsonpath(data, "$.books[$.query].title") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Inserts a slice at a specific location in a vec. | |
pub fn insert_slice_at<T: Copy>(vec: &mut Vec<T>, index: usize, slice: &[T]) { | |
unsafe { | |
assert!(index <= vec.len()); | |
vec.reserve(slice.len()); | |
let insert_ptr = vec.as_mut_ptr().offset(index as isize); | |
std::ptr::copy( | |
insert_ptr, | |
insert_ptr.offset(slice.len() as isize), | |
vec.len() - index, |