Commit graph

24 commits

Author SHA1 Message Date
mntn
ba767bc91f
Fix definition list rendering for multiple terms
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.
2021-08-28 09:33:55 +05:00
Timur Demin
f17a959fe2
Implement definition lists support
This adds the support of Markdown definition lists. The first item in
such lists (the definition itself) is printed without an item prefix.

Fixes #15.
2021-08-27 15:42:00 +05:00
Timur Demin
df6c035c7e
Refactor type detection code 2021-08-23 22:09:41 +03:00
Timur Demin
b4ae1981d6
Implement sort / sortRev in templates
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.
2021-08-22 17:52:19 +03:00
mntn
5265bb6a25 Print delimiters around unsupported formatted elements 2021-08-22 14:31:39 +03:00
mntn
d3e8276e6e Add info string for fenced code blocks 2021-08-22 14:31:39 +03:00
Timur Demin
36922b6e95
Keep line breaks in blockquotes
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.
2021-08-13 09:50:21 +05:00
Timur Demin
845bfa7cb2
Fix panic on empty blockquotes
While renderer previously assumed there would always be a single
paragraph inside the blockquote, there sometimes can be either more or
none.

See #5.
2021-08-13 08:52:52 +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
0be85fc7f9
Handle H4-H6 in accordance with Gemini spec
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.
2021-08-09 12:00:48 +05:00
Timur Demin
1f5257ac90
Fix rendering of links-only paragraphs 2020-11-20 03:59:45 +05:00
Timur Demin
8c1a9a36da
Refactor rendering code
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).
2020-11-19 03:09:28 +05:00
Timur Demin
35b4168935
Comply with Gemini spec p. 5.4.1
This part of spec says soft text wrapping is preferred to hard wrapping,
to comply with that we replace the newlines in raw Markdown text with
spaces.
2020-11-11 23:21:17 +05:00
Timur Demin
ceed6f07f4
Fix rendering of links as first paragraph child
Fixes #2.
2020-11-11 23:21:17 +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
326dc63112
Add support for inline code blocks 2020-11-11 23:21:17 +05:00
Timur Demin
32ec381d73
Add README and license code under GPLv3 2020-11-11 23:21:16 +05:00
Timur Demin
5de6b9b930
Add support for lists 2020-11-08 16:40:49 +05:00
Timur Demin
b2a941bdb6
Add preformatted text block support 2020-11-08 01:07:53 +05:00
Timur Demin
6ee9efab52
Improve the rendering of subsequent links 2020-11-08 00:05:53 +05:00
Timur Demin
3d9314f0a4
Make blockquote read stuff not byte-by-byte 2020-11-07 19:27:55 +05:00
Timur Demin
4799b2b511
Improve newline handling 2020-11-07 19:22:31 +05:00
Timur Demin
49725d712a
Add image/link text render and blockquote support 2020-11-07 17:21:36 +05:00
Timur Demin
85b0ef51b3
Add the latest code 2020-11-06 13:47:02 +05:00