Before this, links would only be scraped from paragraphs and
rendered as a block after parent paragraph. This replaces this logic
with a generic links extractor that would recursively collect every link
from any parent node, including footnotes, blockquotes, and lists.
The renderer splits links block in three separate blocks, one
containing footnotes, the second containing images, and the third
links. Blocks are separated by a single line break.
This also makes the renderer skip link-only lists from rendering,
making them behave like links-only paragraphs (which are already
rendered as a series of consecutive links). The old behavior of
extracting links from links-only paragraphs (where the paragraph
itself is treated as just a set of links) remains, and can be still used.
The text extraction is also now unified across headings, paragraphs,
table headings, blockquotes, and other elements where it was used.
This fixes a number of bugs (like panicking on links inside headings)
and shortcomings where renderer would render text differently
based on container element type.
Fixes#17 and #23.
This makes the renderer write --- in place of
Markdown/HTML horizontal lines, and render super/subscript
as ^(superscript) and _{subscript} respectively.
The original implementation would incorrectly prefix the rest of the terms
if there were multiple terms going after each other (forming a list
themselves).
Fixup f17a959fe2.
This makes the renderer preserve existing line breaks in blockquotes,
provided they do not split paragraphs. Some clients/sites may use this
to form semantic around line breaks (for instance, for poems).
See #5.
This adds support for Markdown table rendering with
github.com/olekukonko/tablewriter. Tables are rendered as ASCII text
in a preformatted text block. Cells are hard-aligned with spaces.
tablewriter options are not yet configurable, although they should be.
For now, extra formatting inside tables is omitted.
Fixes#2.
Unlike Markdown, which has 6 levels of headings, Gemini spec (p. 5.5.1)
only allows up to 3 shebang characters before a space. This adds an extra
space before levels 4-6 in order to comply with the spec.
Fixes#1.
This refactoring simplifies some originally quirky parts of rendering
code while also adding support for rendering emphasized text (handled by
the same routine the ordinary text already is).