Commit graph

13 commits

Author SHA1 Message Date
mntn
ddb3943359
Strip HTML tags but keep content while rendering
This makes the renderer print the content of informational
HTML tags while stripping the tags themselves.

Tags like script, iframe, style, etc, which are unlikely to
ever hold presentable content, are exempt from this, and
their content is skipped from rendering as well as the tags
themselves.

<br>, a hard-break tag, is supported as a Markdown
hard-break replacement (the two spaces before newline).

This also adds tests for this behavior inside general_text.md.

Fixes #6, a longstanding issue with inline HTML in
blockquotes.
2021-10-02 15:07:46 +05:00
Timur Demin
fc76187e13
Implement renderer test suite
This implements a Markdown / Gemtext suite, testing the entire renderer
at complex Markdown documents, containing the entirety of current
Markdown features accessible with gmnhg. The test suite can be expanded
by adding a pair of .md/.gmi files.

Minor bug fixes in JSON/Org metadata parsing where bugs were detected
with the test suite are also included in this patch.

Fixes #13.
2021-09-30 18:01:46 +05:00
Timur Demin
fa5b4cb180
Bump dependencies update 2021-09-17 22:42:45 +05:00
Timur Demin
9778ada128
Parse metadata in all Hugo formats
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.
2021-09-17 22:34:03 +05:00
mntn
2de6e634d6
Add RSS support
This implements RSS timeline generation in gmnhg.

RSS is generated both for the whole site, and for the content
directories as an rss.xml file inside these directories.

RSS requires the absolute URI to the article. For this to work,
a geminiBaseURL setting is required to be set in the Hugo
configuration file (config.toml/json/yaml).

RSS template can be ovewritten on the site-wide /
directory-wise basis; see godoc on how to do this.

As there's no discovery method of an RSS timeline in Gemini,
the users are expected to put a link to rss.xml on their site
where necessary.
2021-09-12 16:26:33 +05:00
mntn
0ac0476e62
Integrate sprig v3 for improved templating (#9) 2021-08-16 20:29:13 +05:00
Timur Demin
e5d791165d Implement tables rendering
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.
2021-08-09 20:13:10 +05:00
Timur Demin
2ea0b7d5fa
Update to Go v1.16 2021-08-01 04:15:32 +05:00
Timur Demin
66b2f83a88
Migrate to GitHub 2021-08-01 04:11:04 +05:00
Timur Demin
b181afc5f1
Add YAML front matter parsing support
Fixes #1. Only a subset of Hugo front matter props are supported, namely
title/date.
2020-11-11 23:21:17 +05:00
Timur Demin
4d80d36f00
Provide a public API
This also introduces a simple program, md2gmn, that is meant for testing
the renderer on Markdown files. Nonetheless, it can be used as
a standalone tool as well.
2020-11-11 23:20:52 +05:00
Timur Demin
f77bdd6b03
Add spew 2020-11-06 13:46:25 +05:00
Timur Demin
178647b4bc
Initial commit 2020-10-29 16:40:00 +05:00