Skip to content

Instantly share code, notes, and snippets.

@hongjr03
Last active December 21, 2024 06:25
Show Gist options
  • Select an option

  • Save hongjr03/d6c3dae9f3192b3a736f788d298c23fa to your computer and use it in GitHub Desktop.

Select an option

Save hongjr03/d6c3dae9f3192b3a736f788d298c23fa to your computer and use it in GitHub Desktop.
#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(
inset: 3pt,
width: 100%,
fill: if rlines.contains(raw_line.number) {
highlight_color
} else {
none
},
grid(
columns: (1em + 4pt, 1fr),
align: (right + horizon, left),
column-gutter: 0.7em,
row-gutter: 0.6em,
if rlines.contains(raw_line.number) {
text(highlight_color.darken(89%), [#raw_line.number])
} else {
text(gray, [#raw_line.number])
},
raw_line,
),
)),
),
)
}
body
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment