diff --git a/docs/template.typ b/docs/template.typ index ef2a1a8..2b81978 100644 --- a/docs/template.typ +++ b/docs/template.typ @@ -24,8 +24,12 @@ show heading.where(level: 3): set text(1.2em) // show link: set text(fill: purple.darken(30%)) - show link: set text(fill: rgb("#1e8f6f")) - show link: underline + show link: it => { + let dest = str(it.dest) + if "." in dest and not "/" in dest { return underline(it, stroke: luma(60%), offset: 1pt) } + set text(fill: rgb("#1e8f6f")) + underline(it) + } v(4em) diff --git a/docs/tidy-guide.typ b/docs/tidy-guide.typ index b734072..c623d42 100644 --- a/docs/tidy-guide.typ +++ b/docs/tidy-guide.typ @@ -129,6 +129,7 @@ In the output, the preview of the code examples is shown next to it. read("/examples/wiggly.typ"), name: "wiggly", scope: (wiggly: wiggly), + label-prefix: "wiggly1-", preamble: "#import wiggly: *\n", old-syntax: false ) @@ -299,6 +300,7 @@ Currently, the two predefined styles `tidy.styles.default` and `tidy-styles.mini read("/examples/wiggly.typ"), name: "wiggly", scope: (wiggly: wiggly), + label-prefix: "wiggly2-", preamble: "#import wiggly: *\n", old-syntax: false ) @@ -471,8 +473,15 @@ Let us now _self-document_ this package: #let style = tidy.styles.default #{ - set heading(numbering: none) set text(size: 9pt) + set heading(numbering: none) + show heading.where(level: 3): set text(1.5em) + show heading.where(level: 4): it => { + set text(1.4em) + set align(center) + set block(below: 1.2em) + it + } let module = tidy.parse-module( ( diff --git a/src/styles/default.typ b/src/styles/default.typ index f6d727f..5c3b7a6 100644 --- a/src/styles/default.typ +++ b/src/styles/default.typ @@ -104,6 +104,9 @@ if "types" in description { types = ": " + description.types.map(x => show-type(x, style-args: style-args)).join(" ") } + if style-args.enable-cross-references and not (description.description == "" and style-args.omit-empty-param-descriptions) { + name = link(label(style-args.label-prefix + fn.name + "." + name.trim(".")), name) + } items.push(name + types) } items.join( if inline-args {", "} else { ",\n "}) diff --git a/src/styles/minimal.typ b/src/styles/minimal.typ index c986121..6a4580a 100644 --- a/src/styles/minimal.typ +++ b/src/styles/minimal.typ @@ -43,15 +43,18 @@ let inline-args = fn.args.len() < 5 if not inline-args { "\n " } let items = () - for (arg-name, info) in fn.args { - if style-args.omit-private-parameters and arg-name.starts-with("_") { + for (name, info) in fn.args { + if style-args.omit-private-parameters and name.starts-with("_") { continue } let types if "types" in info { types = ": " + info.types.map(x => show-type(x)).join(" ") } - items.push(box(arg-name + types)) + if style-args.enable-cross-references and not (info.description == "" and style-args.omit-empty-param-descriptions) { + name = link(label(style-args.label-prefix + fn.name + "." + name.trim(".")), name) + } + items.push(box(name + types)) } items.join( if inline-args {", "} else { ",\n "}) if not inline-args { "\n" } + ")"