The only time underscores aren't special in Markdown is when they appear
in preformatted text. We have gotten away with not escaping underscores
where an asterisk-enclosed span or the paragraph ends before the next
underscore appears, but this is fragile and bad practice. Conversely,
there are many places where we have not escaped underscores but needed
to.
Escape all underscores that do not appear in preformatted blocks or
preformatted spans and are not themselves delineating emphasized spans.
The changes in this commit are exactly the result of executing the
following Bash code:
```bash
e=':x;' # begin loop
e+='s/^' # anchor match at beginning of line
e+='(' # begin capturing subexpression
e+='(' # begin list of alternatives
e+='[^`_\\]|' # any mundane character, or
e+='`([^`\\]|\\.)*`|' # backtick-enclosed span, or
e+='\b_|_\b|' # underscore at boundary, or
e+='\\.' # backslash-escaped character
e+=')*' # any number of the preceding alternatives
e+=')' # end capturing subexpression
e+='\B_\B/\1\\_/;' # escape non-formatting underscore
e+='tx' # repeat loop if we escaped an underscore
escape_underscores=(
sed
# use extended regular expressions
-E
# skip over indented blocks (following an empty line)
-e '/^$/{:i;n;/^( {4,}|\t)/bi}'
# skip over preformatted blocks
-e '/^\s*```/,/^\s*```/{p;d}'
# skip over generated sections
-e '/GENERATE-FROM-SCHEMA-START/,/GENERATE-FROM-SCHEMA-END/{p;d}'
# escape underscores
-e "${e}"
)
"${escape_underscores[@]}" -i doc/*.[0-9].md
```
Changelog-None
This documents how to communicate with lightningd over RPC, including
use of the `filter` object.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: Documentation: `lightningd-rpc` manual page describes details of our JSON-RPC interface, including compatibility and filtering.
There are no definition lists in Markdown, and lists get mangled if
they follow immediately: they need a line between them.
So use bullets for options, and use an indent so the text gets in the
line below.
Here's a before-and-after example:
```diff
--- /tmp/after 2022-07-20 21:55:54.355487769 +0930
+++ /tmp/after2 2022-07-20 21:58:17.305642576 +0930
@@ -10,38 +10,71 @@
lightning-cli sends commands to the lightning daemon.
OPTIONS
- --lightning-dir=DIR Set the directory for the lightning daemon we're talking to; defaults to $HOME/.lightning.
+ • --lightning-dir=DIR
- --conf=PATH Sets configuration file (default: lightning-dir/config ).
+ Set the directory for the lightning daemon we're talking to; defaults to $HOME/.lightning.
- --network=network --mainnet --testnet --signet Sets network explicitly.
+ • --conf=PATH
- --rpc-file=FILE Named pipe to use to talk to lightning daemon: default is lightning-rpc in the lightning directory.
+ Sets configuration file (default: lightning-dir/config ).
- --keywords/-k Use format key=value for parameters in any order
+ • --network=network
- --order/-o Follow strictly the order of parameters for the command
+ • --mainnet
- --json/-J Return result in JSON format (default unless help command, or result contains a format-hint field).
+ • --testnet
- --raw/-R Return raw JSON directly as lightningd replies; this can be faster for large requests.
+ • --signet
- --human-readable/-H Return result in human-readable output.
+ Sets network explicitly.
- --flat/-F Return JSON result in flattened one-per-line output, e.g. { "help": [ { "command": "check" } ] } would become
+ • --rpc-file=FILE
+
+ Named pipe to use to talk to lightning daemon: default is lightning-rpc in the lightning directory.
+
+ • --keywords/-k
+
+ Use format key=value for parameters in any order
+
+ • --order/-o
+
+ Follow strictly the order of parameters for the command
+
+ • --json/-J
+
+ Return result in JSON format (default unless help command, or result contains a format-hint field).
+
+ • --raw/-R
+
+ Return raw JSON directly as lightningd replies; this can be faster for large requests.
+
+ • --human-readable/-H
+
+ Return result in human-readable output.
+
+ • --flat/-F
+
+ Return JSON result in flattened one-per-line output, e.g. { "help": [ { "command": "check" } ] } would become
help[0].command=check. This is useful for simple scripts which want to find a specific output field without parsing
JSON.
- --notifications/-N=LEVEL If LEVEL is 'none', then never print out notifications. Otherwise, print out notifications of
- LEVEL or above (one of io, debug, info (the default), unusual or broken: they are prefixed with # .
+ • --notifications/-N=LEVEL
+
+ If LEVEL is 'none', then never print out notifications. Otherwise, print out notifications of LEVEL or above (one of
+ io, debug, info (the default), unusual or broken: they are prefixed with # .
+
+ • --help/-h
+
+ Pretty-print summary of options to standard output and exit. The format can be changed using -F, -R, -J, -H etc.
+
+ • --version/-V
- --help/-h Pretty-print summary of options to standard output and exit. The format can be changed using -F, -R, -J, -H
- etc.
+ Print version number to standard output and exit.
- --version/-V Print version number to standard output and exit.
+ • allow-deprecated-apis=BOOL
- allow-deprecated-apis=BOOL Enable deprecated options. It defaults to true, but you should set it to false when testing to
- ensure that an upgrade won't break your configuration.
+ Enable deprecated options. It defaults to true, but you should set it to false when testing to ensure that an upgrade
+ won't break your configuration.
COMMANDS
lightning-cli simply uses the JSON RPC interface to talk to lightningd, and prints the results. Thus the commands avail‐
@@ -60,13 +93,13 @@
this is not encouraged.
EXAMPLES
- 1. List commands
+ 1. List commands:
- lightning-cli help
+ • lightning-cli help
- 2. Fund a 10k sat channel using uncomfirmed outputs
+ 2. Fund a 10k sat channel using uncomfirmed outputs:
- lightning-cli --keywords fundchannel id=028f...ae7d amount=10000sat minconf=0
+ • lightning-cli --keywords fundchannel id=028f...ae7d amount=10000sat minconf=0
BUGS
This manpage documents how it should work, not how it does work. The pretty printing of results isn't pretty.
```
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Most unexpected ones are still 1, but there are a few recognizable error codes
worth documenting.
Rename the HSM ones to put ERRCODE_ at the front, since we have non-HSM ones
too now.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
mrkd doesn't like non-ASCII characters in ubuntu:18.04, used for
repro-builds. This is the easiest way to sidestep this issue until we
deprecate the old ubuntu version.
The idea is that you regenerate the man pages in the same commit you
alter them: that's how we know whether to try regenerating them or not
(git doesn't store timestamps, so it can't really tell).
Travis will now check this, so force them all to sync to this commit.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: We now install `lightning-hsmtool` for your `hsm_secret` needs.
See: https://github.com/ElementsProject/lightning/issues/3717#issuecomment-644844594
It seems reasonable to add this to the standard install, and to document it properly as well, hopefully we can fill in the documentation better later on.
ChangeLog-Fixed: Clarified about connection in documentation. Also, `fundchannel` already `connect`s if your node knows how to contact the desired peer for a few versions now, so clarify documentation about this as well.
mrkd started enforcing the `name -- short description` style of top-level
headings somewhere, and was thus failing to build the man-pages. I swapped
the title and with the existing short description to make it work
again. `mrkd` will automatically infer the section from the filename so no
need to put it in the title as well.
In addition I removed the "last updated" lines at the bottom since they are
out of date at best, and misleading at the worst. If we want to keep them, I'd
suggest generating them from the commit that last touched them.