1*6236dae4SAndroid Build Coastguard Worker<!-- 2*6236dae4SAndroid Build Coastguard WorkerCopyright (C) Daniel Stenberg, <[email protected]>, et al. 3*6236dae4SAndroid Build Coastguard Worker 4*6236dae4SAndroid Build Coastguard WorkerSPDX-License-Identifier: curl 5*6236dae4SAndroid Build Coastguard Worker--> 6*6236dae4SAndroid Build Coastguard Worker 7*6236dae4SAndroid Build Coastguard Worker# curldown 8*6236dae4SAndroid Build Coastguard Worker 9*6236dae4SAndroid Build Coastguard WorkerA markdown-like syntax for libcurl man pages. 10*6236dae4SAndroid Build Coastguard Worker 11*6236dae4SAndroid Build Coastguard Worker## Purpose 12*6236dae4SAndroid Build Coastguard Worker 13*6236dae4SAndroid Build Coastguard WorkerA text format for writing libcurl documentation in the shape of man pages. 14*6236dae4SAndroid Build Coastguard Worker 15*6236dae4SAndroid Build Coastguard WorkerMake it easier for users to contribute and write documentation. A format that 16*6236dae4SAndroid Build Coastguard Workeris easier on the eye in its source format. 17*6236dae4SAndroid Build Coastguard Worker 18*6236dae4SAndroid Build Coastguard WorkerMake it harder to do syntactical mistakes. 19*6236dae4SAndroid Build Coastguard Worker 20*6236dae4SAndroid Build Coastguard WorkerUse a format that allows creating man pages that end up looking exactly like 21*6236dae4SAndroid Build Coastguard Workerthe man pages did when we wrote them in nroff format. 22*6236dae4SAndroid Build Coastguard Worker 23*6236dae4SAndroid Build Coastguard WorkerTake advantage of the fact that people these days are accustomed to markdown 24*6236dae4SAndroid Build Coastguard Workerby using a markdown-like syntax. 25*6236dae4SAndroid Build Coastguard Worker 26*6236dae4SAndroid Build Coastguard WorkerThis allows us to fix issues in the nroff format easier since now we generate 27*6236dae4SAndroid Build Coastguard Workerthem. For example: escaping minus to prevent them from being turned into 28*6236dae4SAndroid Build Coastguard WorkerUnicode by man. 29*6236dae4SAndroid Build Coastguard Worker 30*6236dae4SAndroid Build Coastguard WorkerGenerate nroff output that looks (next to) *identical* to the previous files, 31*6236dae4SAndroid Build Coastguard Workerso that the look, existing test cases, HTML conversions, existing 32*6236dae4SAndroid Build Coastguard Workerinfrastructure etc remain mostly intact. 33*6236dae4SAndroid Build Coastguard Worker 34*6236dae4SAndroid Build Coastguard WorkerContains meta-data in a structured way to allow better output (for example the 35*6236dae4SAndroid Build Coastguard Workersee also information) and general awareness of what the file is about. 36*6236dae4SAndroid Build Coastguard Worker 37*6236dae4SAndroid Build Coastguard Worker## File extension 38*6236dae4SAndroid Build Coastguard Worker 39*6236dae4SAndroid Build Coastguard WorkerSince curldown looks similar to markdown, we use `.md` extensions on the 40*6236dae4SAndroid Build Coastguard Workerfiles. 41*6236dae4SAndroid Build Coastguard Worker 42*6236dae4SAndroid Build Coastguard Worker## Conversion 43*6236dae4SAndroid Build Coastguard Worker 44*6236dae4SAndroid Build Coastguard WorkerConvert **from curldown to nroff** with `cd2nroff`. Generates nroff man pages. 45*6236dae4SAndroid Build Coastguard Worker 46*6236dae4SAndroid Build Coastguard WorkerConvert **from nroff to curldown** with `nroff2cd`. This is only meant to be 47*6236dae4SAndroid Build Coastguard Workerused for the initial conversion to curldown and should ideally never be needed 48*6236dae4SAndroid Build Coastguard Workeragain. 49*6236dae4SAndroid Build Coastguard Worker 50*6236dae4SAndroid Build Coastguard WorkerConvert, check or clean up an existing curldown to nicer, better, cleaner 51*6236dae4SAndroid Build Coastguard Workercurldown with **cd2cd**. 52*6236dae4SAndroid Build Coastguard Worker 53*6236dae4SAndroid Build Coastguard WorkerMass-convert all curldown files to nroff in specified directories with 54*6236dae4SAndroid Build Coastguard Worker`cdall`: 55*6236dae4SAndroid Build Coastguard Worker 56*6236dae4SAndroid Build Coastguard Worker cdall [dir1] [dir2] [dir3] .. 57*6236dae4SAndroid Build Coastguard Worker 58*6236dae4SAndroid Build Coastguard Worker## Known issues 59*6236dae4SAndroid Build Coastguard Worker 60*6236dae4SAndroid Build Coastguard WorkerThe `cd2nroff` tool does not yet handle *italics* or **bold** where the start 61*6236dae4SAndroid Build Coastguard Workerand the end markers are used on separate lines. 62*6236dae4SAndroid Build Coastguard Worker 63*6236dae4SAndroid Build Coastguard WorkerThe `nroff2cd` tool generates code style quotes for all `.fi` sections since 64*6236dae4SAndroid Build Coastguard Workerthe nroff format does not carry a distinction. 65*6236dae4SAndroid Build Coastguard Worker 66*6236dae4SAndroid Build Coastguard Worker# Format 67*6236dae4SAndroid Build Coastguard Worker 68*6236dae4SAndroid Build Coastguard WorkerEach curldown starts with a header with meta-data: 69*6236dae4SAndroid Build Coastguard Worker 70*6236dae4SAndroid Build Coastguard Worker --- 71*6236dae4SAndroid Build Coastguard Worker c: Copyright (C) Daniel Stenberg, <[email protected]>, et al. 72*6236dae4SAndroid Build Coastguard Worker SPDX-License-Identifier: curl 73*6236dae4SAndroid Build Coastguard Worker Title: CURLOPT_AWS_SIGV4 74*6236dae4SAndroid Build Coastguard Worker Section: 3 75*6236dae4SAndroid Build Coastguard Worker Source: libcurl 76*6236dae4SAndroid Build Coastguard Worker Protocol: 77*6236dae4SAndroid Build Coastguard Worker - HTTP 78*6236dae4SAndroid Build Coastguard Worker See-also: 79*6236dae4SAndroid Build Coastguard Worker - CURLOPT_HEADEROPT (3) 80*6236dae4SAndroid Build Coastguard Worker - CURLOPT_HTTPAUTH (3) 81*6236dae4SAndroid Build Coastguard Worker TLS-backend: 82*6236dae4SAndroid Build Coastguard Worker - [name] 83*6236dae4SAndroid Build Coastguard Worker Added-in: [version or "n/a"] 84*6236dae4SAndroid Build Coastguard Worker --- 85*6236dae4SAndroid Build Coastguard Worker 86*6236dae4SAndroid Build Coastguard WorkerAll curldown files *must* have all the headers present and at least one 87*6236dae4SAndroid Build Coastguard Worker`See-also:` entry specified. 88*6236dae4SAndroid Build Coastguard Worker 89*6236dae4SAndroid Build Coastguard WorkerIf the man page is for section 3 (library related). The `Protocol` list must 90*6236dae4SAndroid Build Coastguard Workercontain at least one protocol, which can be `*` if the option is virtually for 91*6236dae4SAndroid Build Coastguard Workereverything. If `*` is used, it must be the only listed protocol. Recognized 92*6236dae4SAndroid Build Coastguard Workerprotocols are either URL schemes (in uppercase), `TLS` or `TCP`. 93*6236dae4SAndroid Build Coastguard Worker 94*6236dae4SAndroid Build Coastguard WorkerIf the `Protocol` list contains `TLS`, then there must also be a `TLS-backend` 95*6236dae4SAndroid Build Coastguard Workerlist, specifying `All` or a list of what TLS backends that work with this 96*6236dae4SAndroid Build Coastguard Workeroption. The available TLS backends are: 97*6236dae4SAndroid Build Coastguard Worker 98*6236dae4SAndroid Build Coastguard Worker- `BearSSL` 99*6236dae4SAndroid Build Coastguard Worker- `GnuTLS` 100*6236dae4SAndroid Build Coastguard Worker- `mbedTLS` 101*6236dae4SAndroid Build Coastguard Worker- `OpenSSL` (also covers BoringSSL, LibreSSL, quictls, AWS-LC and AmiSSL) 102*6236dae4SAndroid Build Coastguard Worker- `rustls` 103*6236dae4SAndroid Build Coastguard Worker- `Schannel` 104*6236dae4SAndroid Build Coastguard Worker- `Secure Transport` 105*6236dae4SAndroid Build Coastguard Worker- `wolfSSL` 106*6236dae4SAndroid Build Coastguard Worker- `All`: all TLS backends 107*6236dae4SAndroid Build Coastguard Worker 108*6236dae4SAndroid Build Coastguard WorkerFollowing the header in the file, is the manual page using markdown-like 109*6236dae4SAndroid Build Coastguard Workersyntax: 110*6236dae4SAndroid Build Coastguard Worker 111*6236dae4SAndroid Build Coastguard Worker~~~ 112*6236dae4SAndroid Build Coastguard Worker # NAME 113*6236dae4SAndroid Build Coastguard Worker a page - this is a page descriving something 114*6236dae4SAndroid Build Coastguard Worker 115*6236dae4SAndroid Build Coastguard Worker # SYNOPSIS 116*6236dae4SAndroid Build Coastguard Worker ~~~c 117*6236dae4SAndroid Build Coastguard Worker #include <curl/curl.h> 118*6236dae4SAndroid Build Coastguard Worker 119*6236dae4SAndroid Build Coastguard Worker CURLcode curl_easy_setopt(CURL *handle, CURLOPT_AWS_SIGV4, char *param); 120*6236dae4SAndroid Build Coastguard Worker ~~~ 121*6236dae4SAndroid Build Coastguard Worker~~~ 122*6236dae4SAndroid Build Coastguard Worker 123*6236dae4SAndroid Build Coastguard WorkerQuoted source code should start with `~~~c` and end with `~~~` while regular 124*6236dae4SAndroid Build Coastguard Workerquotes can start with `~~~` or just be indented with 4 spaces. 125*6236dae4SAndroid Build Coastguard Worker 126*6236dae4SAndroid Build Coastguard WorkerHeaders at top-level `#` get converted to `.SH`. 127*6236dae4SAndroid Build Coastguard Worker 128*6236dae4SAndroid Build Coastguard Worker`nroff2cd` supports the `##` next level header which gets converted to `.IP`. 129*6236dae4SAndroid Build Coastguard Worker 130*6236dae4SAndroid Build Coastguard WorkerWrite bold words or phrases within `**` like: 131*6236dae4SAndroid Build Coastguard Worker 132*6236dae4SAndroid Build Coastguard Worker This is a **bold** word. 133*6236dae4SAndroid Build Coastguard Worker 134*6236dae4SAndroid Build Coastguard WorkerWrite italics like: 135*6236dae4SAndroid Build Coastguard Worker 136*6236dae4SAndroid Build Coastguard Worker This is *italics*. 137*6236dae4SAndroid Build Coastguard Worker 138*6236dae4SAndroid Build Coastguard WorkerDue to how man pages do not support backticks especially formatted, such 139*6236dae4SAndroid Build Coastguard Workeroccurrences in the source are instead just using italics in the generated 140*6236dae4SAndroid Build Coastguard Workeroutput: 141*6236dae4SAndroid Build Coastguard Worker 142*6236dae4SAndroid Build Coastguard Worker This `word` appears in italics. 143*6236dae4SAndroid Build Coastguard Worker 144*6236dae4SAndroid Build Coastguard WorkerWhen generating the nroff output, the tooling removes superfluous newlines, 145*6236dae4SAndroid Build Coastguard Workermeaning they can be used freely in the source file to make the text more 146*6236dae4SAndroid Build Coastguard Workerreadable. 147*6236dae4SAndroid Build Coastguard Worker 148*6236dae4SAndroid Build Coastguard WorkerTo make sure curldown documents render correctly as markdown, all literal 149*6236dae4SAndroid Build Coastguard Workeroccurrences of `<` or `>` need to be escaped by a leading backslash. 150*6236dae4SAndroid Build Coastguard Worker 151*6236dae4SAndroid Build Coastguard Worker## Generating contents 152*6236dae4SAndroid Build Coastguard Worker 153*6236dae4SAndroid Build Coastguard Worker`# %PROTOCOLS%` - inserts a **PROTOCOLS** section based on the metadata 154*6236dae4SAndroid Build Coastguard Workerprovided in the header. 155*6236dae4SAndroid Build Coastguard Worker 156*6236dae4SAndroid Build Coastguard Worker`# %AVAILABILITY%` - inserts an **AVAILABILITY** section based on the metadata 157*6236dae4SAndroid Build Coastguard Workerprovided in the header. 158*6236dae4SAndroid Build Coastguard Worker 159*6236dae4SAndroid Build Coastguard Worker## Symbols 160*6236dae4SAndroid Build Coastguard Worker 161*6236dae4SAndroid Build Coastguard WorkerAll mentioned curl symbols that have their own man pages, like 162*6236dae4SAndroid Build Coastguard Worker`curl_easy_perform(3)` are automatically rendered using italics in the output 163*6236dae4SAndroid Build Coastguard Workerwithout having to enclose it with asterisks. This helps ensuring that they get 164*6236dae4SAndroid Build Coastguard Workerconverted to links properly later in the HTML version on the website, as 165*6236dae4SAndroid Build Coastguard Workerconverted with `roffit`. This makes the curldown text easier to read even when 166*6236dae4SAndroid Build Coastguard Workermentioning many curl symbols. 167*6236dae4SAndroid Build Coastguard Worker 168*6236dae4SAndroid Build Coastguard WorkerThis auto-linking works for patterns matching `(lib|)curl[^ ]*(3)`. 169