8.16.0.1
Scribble Cheatsheet🔗ℹ
@title[#:tag "scribble-cheatsheet"]{Scribble Cheatsheet} |
1 Section Header🔗ℹ
1.1 Subsection Header🔗ℹ
1.1.1 Subsubsection header🔗ℹ
Non-numbered header (doesn’t show up in table of contents)
2 Documenting code🔗ℹ
Remember that {} converts to a string and [] doesn’t.
racketblocks require S-expressions
and normalize terms (including formatting).
(map (λ (x) (+ 1 x)) '(1 1/2 3 4 5))
codeblocks typeset verbatim, allow non-S-expression syntax,
and don’t normalize terms.
@codeblock|{ |
#lang scribble/manual |
@italic{me |
ow} |
}| |
2.3 Procedures and Forms🔗ℹ
Names defined with defproc, defform, or defthing
will be linked to from within rackets.
2.3.1 Procedures🔗ℹ
(proc-name arg ... [#:kwarg kwarg-val]) → result-type
|
arg : arg/c |
kwarg-val : kwarg/c = default |
Within this block, things like arg will be typeset to match
the definition (but will error within code).
@defproc[#:kind "default is procedure" |
(proc-name [arg arg/c] ... |
[#:kwarg kwarg-val kwarg/c default]) |
result-type]{ |
Within this block, things like @racket[arg] will be typeset to match |
the definition (but will error within @code{code}). |
} |
Use defproc* to describe related procedures or procedures with multiple
calling cases.
(multi-proc) → result-type-one
|
(multi-proc arg) → result-type-two |
arg : arg/c |
@defproc*[([(multi-proc) result-type-one] |
[(multi-proc (arg arg/c)) result-type-two])] |
defform can specify which identifier it’s defining,
typeset literals, or include a grammar.
(something-special form-name math)
|
|
math | | = | | (op num num) | | | | | | op | | = | | plus | | | | | | minus |
|
@defform[#:kind "default is syntax" |
#:id form-name |
#:literals (define) |
(something-special form-name math) |
#:grammar |
[(math (op num num)) |
(op plus |
minus)]] |
Use defform* for multiple forms using the same identifier.
(define (proc-name arg ...) body ...+)
|
(define var-name body) |
Use defthing to describe non-procedure identifiers.
Everyone knows what a horse is.
@defthing[horse animal?]{ |
Everyone knows what a horse is. |
} |
Use deftech to define vocabulary and tech
to link to it.
A @deftech{technical term} is a term that is technical. |
An example of a @tech{technical term} is |
@tech[#:doc '(lib "scribblings/guide/guide.scrbl")]{number}. |
Margin note (not actually in the margin)
Margin note* (actually in the margin)
Italic
Bold
woah nesting
More: subscript, subscript, larger, smaller.
AAAAAAAAAAAA
@link["https://racket-lang.org"]{normal link} |
@seclink["scribble-cheatsheet"]{back to top (section link within the same module)} |
@seclink["first-example" #:doc '(lib "scribblings/scribble/scribble.scrbl")]{ |
use @racket[#:doc] to link somewhere else |
} |
@secref["first-example" #:doc '(lib "scribblings/scribble/scribble.scrbl")] |