root_node = "Documentation" [nodes.Documentation] text = """ ## Installation For now, if you want to try en, you must build it yourself. In an environment with a |Rust toolchain|https://rustup.rs/ and Git installed, run: ` git clone https://codeberg.org/jutty/en cd en cargo build --release ` The en binary will be in `target/release/en`. You can start it and point it to an address, port and graph: ` en --host localhost --port 3003 --graph ./graph.toml ` See |CLI| for defaults and details on the CLI options. ## Graph Syntax The graph is a |TOML| file. You can create nodes by adding text such as: ` [nodes.Computer] text = "A computer is a machine capable of executing arbitrary instructions." ` If you need longer text, it's more convenient to use triple quotes: ` [nodes.Computer] text = \""" A computer is a machine capable of executing arbitrary instructions. The main electronic component of a computer is its |motherboard|. \""" ` Some special syntax is allowed inside the node text. See |Syntax| for supported features. A node can have several other attributes. See |Node| for details on all of them. ## Connections Nodes can have connections between each other. Each node page lists its outgoing and incoming connections. The simplest kind of connection is achieved by creating an anchor to another node in the node text itself: ` [nodes.Quark] text = "Quarks are subatomic particles that form |hadron|s". ` Here, a connection is created from the node with ID `Quark` to the node with ID `Hadron`. See |AnchorSyntax| for the various ways you can link to other nodes from within the node text itself. Even if a node is not mentioned in the node text, you can still add connections to it. For simple connections without any associated properties, you can simply add links: ` [nodes.Quark] text = "A subatomic particle that forms hadrons." links = [ "Particle", "Hadron" ] ` This will create two outgoing connections from Quark: to Particle and to Hadron. For metadata-rich connections, which allow you to add properties to the connection, you can use the full connection syntax: ` [[nodes.Realism.connections]] to = "Surrealism" kind = "contrast" ` This will create a connection from the node with ID `Realism` to a node with ID `Surrealism` and add the "contrast" kind to the connection. See |Connections| for the existing kinds and how they affect your graph. """ [nodes.docs] redirect = "Documentation" hidden = true [nodes.Node] text = """ A node is defined in your graph file starting with a table header of the form: ` [nodes.ID] ` Where `ID` is an identifier of your choice. While the |TOML| specification is quite flexible regarding what characters can make up this identifier, it's recommended that you keep it simple and use only letters and numbers. See |AnchorSyntax| for more details on why. ## Fields Nodes can have several optional fields that alter how en interprets and displays them. - `title`: The main heading shown at the top of the page and tab title - `text`: The textual content that is shown when the node is accessed - `redirect`: Where to redirect any attempt to access the node - `links`: An array of identifiers for other nodes to which this node is connected - `hidden`: Whether this node should be listed in the index and tree pages. This won't prevent the node from being found or linked to directly through its ID ## Example ` [nodes.Citrus] title = "Citrus Trees" hidden = false text = "Citrus is a |genus| of trees known mainly for its fruits." redirect = "Citric" links = [ "Orange", "Lemon", "Lime", "Grapefruit", ] [[nodes.Citrus.connections]] from = "Citrus" to = "Citric acid" ` ### Default values The example above has all fields in it for completeness, but all fields have default values and are therefore optional. This means that explicitly writing `hidden = false` is the same as not setting it at all. The default values for unset fields are: - `title`: Same as the identifier - `text`: An empty string (i.e. `text = ""`) - `redirect`: An empty string - `links`: An empty array (i.e. `links = []`) - `hidden`: `false` """ [nodes.CLI] title = "CLI Options" text = """ You can set the hostname, port and graph file path using CLI options: For the hostname, use `-h` or `--hostname`: ` en -h localhost en --hostname 10.120.0.5 ` If unspecified, the default is `0.0.0.0`. For the port, use `-p` or `--port`: ` en -p 3003 en --port 3000 ` If unspecified, the default is to use a random available port assigned by the operating system. For the graph path, use `-g` or `--graph`: ` en -g graph.toml en --g ./static/my-graph.toml ` If unspecified, the default is `./static/graph.toml`. You can combine these options as you wish: ` en -h localhost -p 3000 en -p 3003 --host localhost --graph ./graph.toml en --g ./graph.toml -p 1312 ` If an option is specified more than once, the last use will override any previous ones. """ [nodes.Syntax] text= """ Some fields of your en graph, namely the |Node| text field, have support for special syntax that allows you to apply formatting and create connections between your graph's nodes. If you are familiar with Markdown|https://en.wikipedia.org/wiki/Markdown|, you'll find some features familiar, with some notable differences too. ## Anchors Anchors are the most important and powerful syntactic element you will work with because they can create connections between nodes when you use them. They have the following basic syntax: ` anchor|destination ` For example: ` particles|ParticlePhysics ` This example will render as the word "particles" pointing to a node with ID `ParticlePhysics` because the destination is not an external URL. An external anchor looks like this: ` docs|https://en.jutty.dev/node/Documentation ` External anchors are identified by the presence of either a `:` or a `/` character in the destination. This works for special handlers, such as `mailto:user@domain.com`, and destinations relative to the website root like `/about`. If the left side contains spaces, you need a leading `|` character: ` |en docs|https://en.jutty.dev/node/Documentation ` To make a plain address clickable, wrap it in two `|` characters: ` |https://en.jutty.dev| ` ### Trailing characters in anchors For internal anchors, most punctuation is automatically separated from the anchor destination so you can simply write: ` This gem|PreciousStone, though green, was not an emerald. ` > This gem|PreciousStone, though green, was not an emerald. However, for external anchors, you want to add a third `|` to explicitly set the end because external URLs can have all sorts of arbitrary characters. ### Node anchors Because anchors between nodes are central to en, there is special syntax to make them as fluid as possible to create without cluttering the text too much. A node ID wrapped in two `|` characters will become an anchor to that node: ` |ParticlePhysics| ` en can resolve IDs case insensitively (with priority to case-sensitive matches) and will also collapse spaces when trying to resolve an ID, so you can also write: ` check out the |en documentation| ` And if an anchor with the id `enDocumentation` or any other case-insensitive combination exists, it will land on it. In summary, all of the anchors below are valid and lead to the same page: ` |syntax|Syntax Syntax|syntax Syntax|syn tax| |Syntax| |syntax| |syn tax| ` While flexible, this can sometimes be ambiguous. See |AnchorSyntax| for some caveats regarding anchors. ## Formatting Supported formatting syntax includes: - `*` for bold - `_` for italics - `__` for underline - `~~` for strikethrough To apply these, you can wrap a word in the formatting operators, so for instance `*this*` will be rendered as *this* and `~~this~~` as ~~this~~. ## Checkboxes You can use `[ ]` and `[x]` to render checkboxes: ` - [ ] not done - [x] done ` - [ ] not done - [x] done ## Blocks A block is any group of lines separated by empty lines: ` block A still block A block A's last line block B starts here block B ends here this is block C ` By default, a block not starting with any special syntax is a paragraph, such as this very line you are reading. Some blocks will join the lines together, meaning even if you write: ` a b c ` You still get "a b c" as a result. This is the case for paragraphs, but not for lists, verse blocks and preformatted text. Blockquotes support both modes. This is useful when editing your text, allowing you to break some thoughts and special syntax without losing control over where your paragraph ends, particularly when handling huge paragraphs. If you want to force lines to break, you can use a `<` character at the end of a line: ` a < b < c < ` Which renders as: a < b < c < While useful to break a few lines on demand, if you have a large block of lines you want to break this can become cumbersome. That's where verse blocks are useful. ### Verse Verse blocks are delimited by a `&` character at their first and last line and are useful to avoid precisely this line-joining behavior of paragraphs. They will break all lines without need for a trailing `<` character: ` & these lines break just fine once they are over & ` & these lines break just fine once they are over & ### Quotes A block of lines starting with a `>` character will render as a quote: ` > Who'll change old lamps for new ones? ` > Who'll change old lamps for new ones? Quote blocks have two forms. If you prepend all blocks with a `>`, line breaks will be preserved, not collapsing the whole quote into a single line: ` > When I was alive > I was dust which was, > But now I am dust in dust > I am dust which never was. ` > When I was alive > I was dust which was, > But now I am dust in dust > I am dust which never was. If you would like the quote to be collapsed into a single line instead, you can leave just the first `>` and continue until the next empty line: ` > Dois grandes mitos dominam a história oficial do Brasil: o mito da índole pacífica do brasileiro e o da "democracia racial". -- Benedita da Silva, Speech on the Federal Senate, March 3rd, 1995 ` > Dois grandes mitos dominam a história oficial do Brasil: o mito da índole pacífica do brasileiro e o da "democracia racial". -- Benedita da Silva, Speech on the Federal Senate, March 3rd, 1995 You can still use `<` characters to force line breaks in this case. #### Citation To add a citation to your quote block, start a line with two `-` characters: ` > with no more communion > to down as morning pick-me-ups > to sweeten afternoon naps > to soothe nightmares -- Assotto Saint, The Language of Dust ` > with no more communion > to down as morning pick-me-ups > to sweeten afternoon naps > to soothe nightmares -- Assotto Saint, The Language of Dust If you have a more complex citation, you can use multiple lines starting with `--`. All such lines will be joined together in the citation. If you need to break lines, use the `<` character at the end of a line: ` > Dois grandes mitos dominam a história oficial do Brasil: o mito da índole pacífica do brasileiro e o da "democracia racial". -- Benedita da Silva, -- |Speech on the Federal Senate|https://www25.senado.leg.br/web/atividade/pronunciamentos/-/p/pronunciamento/165765|, -- March 3rd, 1995, < -- International Day for the Elimination of Racial Discrimination. ` > Dois grandes mitos dominam a história oficial do Brasil: o mito da índole pacífica do brasileiro e o da "democracia racial". -- Benedita da Silva, -- |Speech on the Federal Senate|https://www25.senado.leg.br/web/atividade/pronunciamentos/-/p/pronunciamento/165765|, -- March 3rd, 1995, < -- Dia Internacional para a Eliminação da Discriminação Racial. The first URL found in your citation will be used as the blockquote element's `cite` field. ### Lists A block of lines starting with a `-` character will be rendered as an unordered list: ` - cyan - amber - crimson ` - cyan - amber - crimson Lines starting with a `+` character will create numbered lists instead: ` + ichi + ni + san ` + ichi + ni + san ## Rendering unformatted text The backtick character `\\`` can be used to render unformatted blocks and inline text: ` The asterisk `*` is special in en markup syntax. ` > The asterisk `*` is special in en markup syntax. Using the syntax above, the asterisk won't be interpreted as the start of bold formatting and instead will be shown like this: `*`. This is useful for code but also for rendering characters with special meaning you wish to mention literally. Backticks on their own line will start and close a block of unformatted text such as the ones being used throughout this documentation to show code: ` \\` everything in here will be rendered without formatting \\` ` Finally, you can precede any character with a `\\\\` to fully _escape_ that character from being interpreted. Because |TOML| also treats backslashes specially, you'll likely need to use double slashes, as in `\\\\\\\\`, unless you wrap your TOML strings in single quotes. See |Escaping| for more details and examples. ## Raw HTML If you need some more advanced feature that is not supported directly by en's markup snytax, you can always just write plain HTML and it will be passed along. For example, you could render a table: ` <table> <tr> <td> Hi, </td> <td> *HTML*! </td> </tr> </table> `
| Hi, | *HTML*! |