This file contains hidden or 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 bcol(..args) = layout(container => context { | |
let num-columns = args.pos().first() | |
let body = args.pos().at(1) | |
let parent-places = body.children.filter(x => ( | |
"scope" in x.fields() and x.fields().scope == "parent" | |
)) | |
let gutter = if "gutter" in args.named() { args.named().gutter } else { (4% + 0pt).length } | |
let column-width = (container.width - gutter * (num-columns - 1)) / num-columns |
This file contains hidden or 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
⭐ Total Stars: 142 | |
➕ Total Commits: 1,013 | |
🔀 Total PRs: 158 | |
🚩 Total Issues: 43 | |
📦 Contributed to: 34 |
This file contains hidden or 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
Rust 11 hrs 27 mins ████████████▌░░░░░░░░ 59.6% | |
Typst 5 hrs 40 mins ██████▏░░░░░░░░░░░░░░ 29.5% | |
JavaScript 29 mins ▌░░░░░░░░░░░░░░░░░░░░ 2.6% | |
Markdown 19 mins ▎░░░░░░░░░░░░░░░░░░░░ 1.7% | |
TypeScript 17 mins ▎░░░░░░░░░░░░░░░░░░░░ 1.5% |
This file contains hidden or 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 typ(body) = html.elem( | |
"typ", | |
{ | |
// distinguish parbreak from <p> tag | |
show parbreak: it => html.elem("typParbreak", "") | |
show linebreak: it => html.elem("typLinebreak", "") | |
show strong: it => html.elem("typStrong", it.body) | |
show emph: it => html.elem("typEmph", it.body) | |
show highlight: it => html.elem("typHighlight", it.body) |
This file contains hidden or 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
// 替换 USERNAME 为你的 GitHub 用户名,将结果放在 contribution.json 文件中 | |
// 然后运行这个文件,生成的图片就是你的 GitHub 贡献图 | |
// https://github-contributions-api.jogruber.de/v4/USERNAME | |
#set page(width: auto, height: auto) | |
#{ | |
let contribution-json = json("contribution.json") | |
.contributions | |
.map(ct => { |
This file contains hidden or 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 t(traverse: x => { x }, body) = { | |
let nodes = ( | |
( | |
heading: none, | |
elems: (), | |
children: (), | |
), | |
) | |
let curr_depth = 0 |
This file contains hidden or 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 hanging-indent(body, indent: 0.5em) = { | |
let unpack(arr) = { | |
if type(arr) == array { | |
arr.map(it => unpack(it)) | |
} else if repr(arr.func()) == "sequence" { | |
unpack(arr.children) | |
} else if repr(arr.func()) == "item" { | |
if repr(arr.body.func()) == "sequence" { | |
unpack(arr.body) | |
} else { |
This file contains hidden or 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 page(paper: "a4") | |
#let page-width = 595.28pt - 2 * 2.5cm // A4, 页宽减去页边距 | |
// #set enum(numbering: "A.") | |
#let with-ans = state("with-ans", true) | |
#show list: it => context { | |
let item-counter = counter("item") | |
item-counter.update(1) |
This file contains hidden or 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 hr(rlines: none, body, highlight_color: rgb("#fffd11a1").lighten(70%)) = { | |
show raw.where(block: true): it => { | |
set par(justify: false) | |
block( | |
fill: luma(245), | |
inset: (top: 4pt, bottom: 4pt), | |
radius: 4pt, | |
width: 100%, | |
stack( | |
..it.lines.map(raw_line => block( |
This file contains hidden or 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
function convertToTypst(worksheet) { | |
const range = XLSX.utils.decode_range(worksheet["!ref"]); | |
const columns = range.e.c - range.s.c + 1; | |
const merges = worksheet["!merges"] || []; | |
let typstCode = `#table(columns: ${columns},\n`; | |
for (let row = range.s.r; row <= range.e.r; row++) { | |
typstCode += " "; | |
for (let col = range.s.c; col <= range.e.c; col++) { |
NewerOlder