mirror of https://github.com/kdl-org/kdl.git
Use ~~~kdl instead of `` for strings with significant whitespace.
That compiles to <sourcecode> which preserves sequences of spaces.
This commit is contained in:
parent
7a77c4ee81
commit
7f1c8b1aad
|
|
@ -446,8 +446,19 @@ interpreted as described in the following table:
|
||||||
|
|
||||||
In addition to escaping individual characters, `\` can also escape whitespace.
|
In addition to escaping individual characters, `\` can also escape whitespace.
|
||||||
When a `\` is followed by one or more literal whitespace characters, the `\`
|
When a `\` is followed by one or more literal whitespace characters, the `\`
|
||||||
and all of that whitespace are discarded. For example, `"Hello World"` and
|
and all of that whitespace are discarded. For example,
|
||||||
`"Hello \ World"` are semantically identical. See whitespace ({{whitespace}})
|
|
||||||
|
~~~kdl
|
||||||
|
"Hello World"
|
||||||
|
~~~
|
||||||
|
|
||||||
|
and
|
||||||
|
|
||||||
|
~~~kdl
|
||||||
|
"Hello \ World"
|
||||||
|
~~~
|
||||||
|
|
||||||
|
are semantically identical. See whitespace ({{whitespace}})
|
||||||
and [newlines](#newline) for how whitespace is defined.
|
and [newlines](#newline) for how whitespace is defined.
|
||||||
|
|
||||||
Note that only literal whitespace is escaped; whitespace escapes (`\n` and
|
Note that only literal whitespace is escaped; whitespace escapes (`\n` and
|
||||||
|
|
@ -550,7 +561,12 @@ This is the base indentation
|
||||||
bar
|
bar
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
which is equivalent to `" foo\nThis is the base indentation\n bar"`
|
which is equivalent to
|
||||||
|
|
||||||
|
~~~kdl
|
||||||
|
" foo\nThis is the base indentation\n bar"
|
||||||
|
~~~
|
||||||
|
|
||||||
when written as a single-line string.
|
when written as a single-line string.
|
||||||
|
|
||||||
#### Shorter last-line indent
|
#### Shorter last-line indent
|
||||||
|
|
@ -574,7 +590,11 @@ This example's string value will be:
|
||||||
bar
|
bar
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
Equivalent to `" foo\n This is no longer on the left edge\n bar"`.
|
Equivalent to
|
||||||
|
|
||||||
|
~~~kdl
|
||||||
|
" foo\n This is no longer on the left edge\n bar"
|
||||||
|
~~~
|
||||||
|
|
||||||
#### Empty lines
|
#### Empty lines
|
||||||
|
|
||||||
|
|
@ -596,7 +616,11 @@ Indented a bit.
|
||||||
A second indented paragraph.
|
A second indented paragraph.
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
Equivalent to `"Indented a bit.\n\nA second indented paragraph."`
|
Equivalent to
|
||||||
|
|
||||||
|
~~~kdl
|
||||||
|
"Indented a bit.\n\nA second indented paragraph."
|
||||||
|
~~~
|
||||||
|
|
||||||
#### Syntax errors
|
#### Syntax errors
|
||||||
|
|
||||||
|
|
@ -719,7 +743,13 @@ Here's a """
|
||||||
without escapes.
|
without escapes.
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
or equivalently, `"Here's a \"\"\"\n multiline string\n \"\"\"\nwithout escapes."` as a Quoted String.
|
or equivalently,
|
||||||
|
|
||||||
|
~~~kdl
|
||||||
|
"Here's a \"\"\"\n multiline string\n \"\"\"\nwithout escapes."
|
||||||
|
~~~
|
||||||
|
|
||||||
|
as a Quoted String.
|
||||||
|
|
||||||
## Number
|
## Number
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue