On this page:
rhombus
rhombuslink
rhombusblock
rhombusblock_  etc
rhombus_  typeset
rhombusmodname
rhombuslangname
racketmodname
8.17.0.6

3.1 Typesetting Code🔗ℹ

expression

rhombus(group)

 

expression

rhombus(group, builtin_space)

 

expression

rhombus(group, ~at space_name)

 

builtin_space

 = 

~var

 | 

~datum

 | 

~value

 | 

~result

 | 

~expr

 | 

~defn

 | 

~decl

 | 

~bind

 | 

~impo

 | 

~expo

 | 

~modpath

 | 

~annot

 | 

~repet

 | 

~stxclass

 | 

~reducer

 | 

~class

 | 

~space

 | 

~for_clause

 | 

~class_clause

 | 

~interface_clause

 | 

~veneer_clause

 | 

~entry_point

 | 

~unquote_bind

 | 

~syntax_class_clause

 | 

~pattern_clause

 | 

~space_clause

 | 

~space_meta_clause

 | 

~key_comp

 | 

~immediate_callee

 | 

~operator_order

 | 

~doc

Typesets group literally, except as adjusted by spacers and typesetting transformers. The result is an Element to appear inline in a paragraph. Spacing in group is normalized, instead of preserved exactly as in the source.

Use #,(expr) within group to escape from literal mode and substitute the element produced by expr.

A builtin_space or space name after ~at supplies the initial space to use for creating hyperlinks in group based on meta_label imports.

Typesetting and hyperlinking can be adjusted via spacers, which can select an alternative space for components of group for hyperlinking. That is, a supplied builtin_space or ~at space_name specifies the initial space of group, but a spacer binding can determine the space of subsequent elements of group.

Even before applying spacers, identifiers in group bound as typesetting transformers are replaced with their transformations. That’s how metavariables get typeset as italic, for example: each metavariable is bound as a transformer that adds the ~var space to the identifier.

expression

rhombuslink(name, content, ... ~nonempty)

 

expression

rhombuslink(name, builtin_space, content, ... ~nonempty)

 

expression

rhombuslink(name, ~at space_name, content, ... ~nonempty)

Link rhombus, but uses the text of elem([content, ...]) preserving the hyperlink (if any) of name.

expression

rhombusblock(group, ...)

Similar to rhombus, but producing a FlowBlock for multiple groups and with whitespace preserved exactly as in the source.

Note that when you use @ notation to call rhombusblock, then no comma is required between groups that are on separate lines. So, for example,

@rhombusblock(

  fun add(x, y):

    x + y

  add(1, 2)

)

renders as

fun add(x, y):

  x + y

add(1, 2)

without adding a comma after the add definition. If the source does contain a comma, then is preserved in the output.

expression

rhombusblock_etc:

  group

  ...

 

expression

rhombusblock_etc (option, ...):

  group

  ...

 

option

 = 

~escape: op

 | 

~inset: body; ...

 | 

~indent: body: ...

 | 

~prompt: body: ....

 | 

~indent_from_block: body; ...

 | 

~spacer_info_box: body; ...

 | 

~number_from: body; ...

Like rhombusblock, but supports options:

  • ~escape: Replaces the escape operator #, with op so that #, is literal (assuming that op is different from #,).

  • ~inset: Insets the block relative to surrounding text if the body sequence after ~inset produces a true value. The default is to inset.

  • ~indent: Adds space before each line of the block to indent by the amount produced by the body sequence after ~indent. The indentation amount must be a nonnegative integer that is treated as a character count. The default is 0 indentation.

  • ~prompt: Uses the string produced by the body sequence after ~prompt as a prompt that prefixes the first line of the content, and lines afterward get the same number of spaces as characters in the prompt. The default is to show no prompt, which is equivalent to an empty string.

  • ~indent_from_block: Uses the indentation of the block overall, instead of the first item in the block, to infer relative indentation for rendered content if the body sequence after ~indent_from_block produces a true value. The default is true.

  • ~spacer_info_box: If the body sequence after ~spacer_info_box produces a box, and if the same box is used for multiple rhombusblock_etc forms, then spacer information is shared across the forms. For example, when forms a is treated as bindings that associates an annotation with an identifier, that association can persist for later blocks. The default is for each block to collect independent spacer information.

  • ~number_from: If the body sequence after ~number_from produces a value other than #false, it must be a number to write to the left of the first line of rendered output, and subsequent lines are numbered accordingly.

definition

rhombus_typeset 'id':

  body

  ...

Binds id so that when it is used in rhombus or rhombusblock, the use of id is replaced with the result of the body sequence.

expression

rhombusmodname (module_path)

 

expression

rhombuslangname (module_path)

 

expression

racketmodname (module_path)

Form for referencing Rhombus modules, languages, and Racket modules.