Gemini spec p. 5.5.1 used to only allow up to three #-s in a heading
before requiring a mandatory space. It changed to an optional space in
recent updates, allowing to no longer pad Markdown H4-H6.
As clients treat everything after ### a title continuation, the renderer
will now insert H4-H6 verbatim; the end-user behavior doesn't change as
extra space means nothing for a Gemtext renderer displaying the title in
a special way.
Relates to #1.
PS: Gemini spec doesn't appear to be properly versioned, saying the
latest version is 0.14.3, 2020-11-29. The discussion on #1 clearly shows
it used to be different a while ago.
This makes gmnhg parse TOML/YAML/JSON/org-mode front matter in Hugo posts.
This also makes the library no longer render metadata in posts, removing
the API to do so. The metadata parsing code itself moves to
internal/gmnhg.
As the library no longer has a preset to include metadata in rendered
document, md2gmn will from now on silently discard front matter if it
encounters any.
Fixes#28. Unblocks #13.
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 adds generic sort / sortRev functions for use in gmnhg templates
which use sort.Sort to sort anything that implements sort.Interface
(which includes lists of posts).
The existing sortPosts function that used to sort posts in reverse order
becomes an alias to sortRev for backwards compatibility.
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).