diff --git a/doc/UsersGuide/Extensions.lean b/doc/UsersGuide/Extensions.lean index d6f0970cb..9fa08d546 100644 --- a/doc/UsersGuide/Extensions.lean +++ b/doc/UsersGuide/Extensions.lean @@ -31,12 +31,14 @@ tag := "extension-syntax" All four extension points share a common syntax. They are invoked by name, with a sequence of arguments. These arguments may be positional or by name, and their values may be identifiers, string literals, or numbers. +Boolean flags may be passed by preceding their name with `-` or `+` for {lean}`false` or {lean}`true`, respectively. :::paragraph In this example, the directive `syntax` is invoked with the positional argument `term` and the named argument `title` set to `"Example"`. +The flag `check` is set to `false`. It contains a descriptive paragraph and the code block `grammar`, which is invoked with no arguments: ```` -:::syntax term (title := example) +:::syntax term (title := example) -check This is an example grammar: ```grammar term ::= term "<+-+>" term @@ -49,7 +51,7 @@ term ::= term "<+-+>" term More formally, an invocation of an extension should match this grammar: ``` CALL := IDENT ARG* -ARG := VAL | "(" IDENT ":=" VAL ")" +ARG := VAL | "(" IDENT ":=" VAL ")" | "+" IDENT | "-" IDENT VAL := IDENT | STRING | NUM ``` A `CALL` may occur after an opening fence on a code block. diff --git a/doc/UsersGuide/Markup.lean b/doc/UsersGuide/Markup.lean index 316cb4fb2..d00047f58 100644 --- a/doc/UsersGuide/Markup.lean +++ b/doc/UsersGuide/Markup.lean @@ -97,7 +97,7 @@ partial def preview (stx : Syntax) : m Std.Format := | `(block| command{$x $args*}) => do let args ← args.toList.mapM (preview ·.raw) pure s!"<{x.getId.toString} {Std.Format.prefixJoin " " args |>.pretty}/>" - | `(argument|$x:ident := $v) => do + | `(argument|($x:ident := $v)) | `(argument|$x:ident := $v) => do pure <| s!"{x.getId.toString}=\"{← preview v.raw}\"" | `(argument|$v:arg_val) => preview v.raw | `(arg_val|$v:ident) => pure s!"{v.getId}" @@ -419,6 +419,15 @@ Metadata blocks begin and end with `%%%`, and they contain any syntax that would ``` ::: +:::markupPreview "Blah" +``` +a b c +``` +``` +

a b c

+``` +::: + ## Block Syntax %%% diff --git a/doc/UsersGuide/Output.lean b/doc/UsersGuide/Output.lean index 73bdba854..8a08e77c8 100644 --- a/doc/UsersGuide/Output.lean +++ b/doc/UsersGuide/Output.lean @@ -56,7 +56,7 @@ The differences are: * Interpolated Lean strings (with `s!`) may be used in any context that expects a string. For example, this definition creates a `