Scrolltext Format

This document is an extracted (and modified) section taken from the Scroll Protocol specification on 2024-05-06 from:

=> gemini://scrollprotocol.us.to/spec.scroll

I agree with the author, Christian Siebold, that Gemtext is more restrictive than I'd like. I do sometimes need level 4 headings, and the inline phrase markup as commonly used for emphasis and strong emphasis is very useful. I am adopting those portions of Scrolltext, along with the thematic break (which I have long been encoding as a line containing a single "⁂" asterism character). The rest of the Scroll protocol is too much like MarkDown and HTML/HTTP/HTTPS: too complex.
This document is currently available at the following addresses:

=> gemini://jdcard.com/scrolltext.gmi | https://jdcard.com/scrolltext.gmi | spartan://jdcard.com:3300/scrolltext.gmi

Mimetype: text/scroll

File Extension: .scroll

The scrolltext format is a descriptive-presentational markup language inspired by gemtext, markdown, and AsciiDoc. It is designed to be streamable and easy to parse, and contains the most important elements within most textual documents, printed and digital. Scrolltext is therefore line-based, much like gemtext.

Paragraphs

Each line with none of the line prefixes below should be interpreted as paragraphs. Lines are not reflowed, but they may be word-wrapped.

Inline Preformatted

Paragraphs may include *asterisks* for strong, _underscores_ for emphasis, or backticks for monospace or code, which acts as inline preformatted text. Clients may choose not to render these, however.


Torture Tests

These paragraphs, which were not part of the original source document, are here solely to test the client's rendering of inline markup. Note that "inline preformatted" precludes the use of emphasis or strong phrases within the preformatted section; their "_" or "*" markup characters will be displayed just as if they were in a preformatted block. The markup will be presented first in a preformatted block, followed by the same line as regular text.

_Emphasized_ is often rendered as italic text.

Emphasized is often rendered as italic text.

*Strong* is often displayed using a bold typeface.
_Emphasized_ *_and_* *strong*.

Emphasized and strong.

_Emphasized_ *_and_* *strong* are not the same as `code or _inline preformatted_` text.

Emphasized and strong are not the same as code or _inline preformatted_ text.

Perhaps we should include some "`sample code`" to verify.

Perhaps we should include some "sample code" to verify.

---
## Preformatted Blocks
Preformatted blocks should not be word-wrapped or justified, but they can be character-wrapped. Preformatted blocks are toggled with three backticks on the start of a line, with an optional alt-text after the three backticks. This toggle denotes the start or end of a preformatted block.

Preformatted blocks are toggled with three backticks (```) on the start of a line.

Added by Christian Siebold on 2024-05-17, see:
=> gemini://scrollprotocol.us.to/devlog/20240517.gmi
Code blocks define a block within the scrolltext that should be distinguished from the rest of the document as a textual format. They may be used for code blocks, ASCII Art, plain text, or other textual formats. They are usually presented visually in fixed-width fonts. Audal presentations should distinguish them from the surrounding text and should present the format tag to the listener.
 
Code blocks' visual presentation should not be word-wrapped or justified, but they may be character-wrapped. Code blocks are toggled with three backticks on the start of a line. This toggles the start or end of a code block.

The starting toggle of a code block may include an optional tag just after the three backticks that describes the format. Mimetypes starting with `text/` are permitted, but the `text/` prefix should be excluded. Therefore, `text/plain` should be written `plain`. [The officially recognized list of `text/*` media-types from IANA is contained in this CSV file:]
=> https://www.iana.org/assignments/media-types/media-types.xhtml#text
=> text.csv IANA text/* media-types (CSV)

Examples of code block tags include:
* ascii-art
* plain
* a programming language name
* `samp` for sample software input/output

## Headings
Heading lines are prefixed with `#`, `##`, `###`, and an additional fourth-level heading `####` and fifth-level heading `#####`, much like in gemtext and markdown. The first level-1 heading of a scrolltext page should be interpreted as the document's title; there should be no other level-1 heading in the document.

⁂
### Heading Samples
There are already enough #, ##, and ### headings in this document. Here are samples of the other two types:

Level 4 Heading

This paragraph provides some sample "level 4" text.

#### Level 4 Heading
This paragraph provides some sample "level 4" text.

Level 5 Heading

This paragraph provides some sample "level 5" text.

##### Level 5 Heading
This paragraph provides some sample "level 5" text.

Level 6 heading

Oops! What happens here?

###### Level 6 heading
Oops! What happens here?
⁂

### Heading Numbers
Clients may give sections heading numbers, like `1`, `3.2`, and `1.4.3`. Dots delimit the level of the heading, where `3.2` refers to the second level-3 heading under the third level-2 heading. Note that the first number always denotes a level-2 heading.

=> Link to "Links To Sections"

=> #7.1 Link to "Links To Sections"

Level-5 headings do not need to be placed directly under a level-4 heading; they may be placed under any heading levels 1-4. They are always considered textual titles rather than section titles, and therefore should be excluded from outlines and tables of contents (e.g., the titling of a paragraph or set of paragraphs).

## Thematic Breaks
Thematic breaks use three hyphens (`---`) on their own line. They are usually rendered as horizontal rules or three asterisks (which is the common rendering in printed books). They should be interpreted as thematic breaks within the section denoted by a level 1-4 heading. Note that they are never interpreted as being underneath level-5 headings.


---

## Quotes
Quotes are prefixed with `>`. They may be nested. Quoted lines may be separated from each other by placing a blank line in between them.
Sam said something that he heard from George.
Hello, my name is George.
> Sam said `something` that he heard from George.
>> Hello, *my* _name_ is George.

## Lists
Unordered lists (bullets) are prefixed with an asterisk followed by a required whitespace character (`* `). It is the only linetype with a prefix that requires one whitespace character (a space or a tab). This *is* consistent because it is the only exception, an exception that allows one to distinguish between lines that begin with bold text (for clients that choose to render this) and unordered lists. Lists can be separated from each other by placing a blank line in between them.

Unordered bullets may be nested by placing two or more asterisks next to each other, up to a limit of 4, followed by a space, like so: `** nested bullet`.

Ordered lists use asterisks like the unordered bullets above, but the text starts with any number of decimal digit unicode codepoints (e.g., Rust's `char.is_digit(10)` or Golang's `unicode.IsDigit(r)`), followed by a dot ('.'), or by *one* character between 'a' and 'Z' followed by a dot. Rendering these differently from unordered lists is optional. Clients that choose to do so should render the number/character that was provided and not try to renumber the items. Ordered lists may be nested just like Unordered lists.
* Unordered list item 1
** 1. Ordered sub-list item 1
** 2. Ordered sub-list item 2
* Unordered list item 2

## Links
Links use the following format:

=> Text

Whitespace may be any number of spaces or tabs above zero. The parentheses denote optionality.

### Links To Sections
The URL may be replaced with a `#hash` identifier to link to another heading/section of the current document. The hash for scrolltext documents should be the heading number described above (e.g., `3.2.4`). Hashes on URLs should be interpreted as links to a section/heading within the linked document.

### Links As Quote Citations
Links that are placed just under a quote should be interpreted as the citation for that quote. For example:
This is a quote

=> Cited Text Name

Proxy Information
Original URL
gemini://jdcard.com/scrolltext.gmi
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
635.757532 milliseconds
Gemini-to-HTML Time
1.972984 milliseconds

This content has been proxied by September (ba2dc).