summaryrefslogtreecommitdiff
path: root/tests/typ
diff options
context:
space:
mode:
authorLU Jialin <luxxxlucy@gmail.com>2023-09-11 16:46:39 +0800
committerGitHub <noreply@github.com>2023-09-11 10:46:39 +0200
commit71dccde031dedc285042257c7e16bafb152dde58 (patch)
tree9ca1f2c1acbde6af59e643b5457f0912cd606790 /tests/typ
parent09442d93eebf176e42d768cbe7b5c31d331dc907 (diff)
Provide `highlight` function for setting the background color of text (#2076)
Diffstat (limited to 'tests/typ')
-rw-r--r--tests/typ/text/deco.typ32
1 files changed, 29 insertions, 3 deletions
diff --git a/tests/typ/text/deco.typ b/tests/typ/text/deco.typ
index f3be17e7..b79b80b2 100644
--- a/tests/typ/text/deco.typ
+++ b/tests/typ/text/deco.typ
@@ -20,14 +20,40 @@
---
#let redact = strike.with(stroke: 10pt, extent: 0.05em)
-#let highlight = strike.with(stroke: 10pt + rgb("abcdef88"), extent: 0.05em)
+#let highlight-custom = strike.with(stroke: 10pt + rgb("abcdef88"), extent: 0.05em)
// Abuse thickness and transparency for redacting and highlighting stuff.
Sometimes, we work #redact[in secret].
-There might be #highlight[redacted] things.
- underline()
+There might be #highlight-custom[redacted] things.
---
// Test stroke folding.
#set underline(stroke: 2pt, offset: 2pt)
#underline(text(red, [DANGER!]))
+
+---
+// Test highlight.
+This is the built-in #highlight[highlight with default color].
+We can also specify a customized value
+#highlight(fill: green.lighten(80%))[to highlight].
+
+---
+// Test default highlight bounds.
+#highlight[ace],
+#highlight[base],
+#highlight[super],
+#highlight[phone #sym.integral]
+
+---
+// Test a tighter highlight.
+#set highlight(top-edge: "x-height", bottom-edge: "baseline")
+#highlight[ace],
+#highlight[base],
+#highlight[super],
+#highlight[phone #sym.integral]
+
+---
+// Test a bounds highlight.
+#set highlight(top-edge: "bounds", bottom-edge: "bounds")
+#highlight[abc]
+#highlight[abc #sym.integral]