Commit graph

49 commits

Author SHA1 Message Date
Timur Demin
d8870403fe
Add golangci-lint config
Somehow the config managed to stay in .gitignore a while, causing
CI checks to fail.
2021-08-13 09:08:45 +05:00
Timur Demin
a35536c8be
Make linter happy
This removes some of the leftovers of older logic in cmd/gmnhg.
2021-08-13 09:00:37 +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
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
d182adba8c
Add version display 2021-02-19 16:57:16 +05:00
Timur Demin
ae794d9d59
Comment on sortPosts behaviour 2021-02-19 16:47:14 +05:00
Timur Demin
cf65fcc5c3
Fix gmnhg crash on non-existent static/ 2021-01-23 00:25:02 +05:00
Timur Demin
7eaf6b7c8a
Fix #8
This fixes trailing newlines at the end of Gemtext being left.
2020-12-12 16:30:25 +05:00
Timur Demin
d89c4b5e50
Reword RenderMarkdown docstring 2020-12-12 14:06:22 +05:00
Timur Demin
47e056f253
Refactor RenderMarkdown signature
This makes the function accept a bitmask instead of a single flag. This
is a breaking change.
2020-12-12 14:03:29 +05:00
Timur Demin
30a5d407e2
Add Docker build files 2020-11-21 23:19:34 +05:00
Timur Demin
26fcc06075
Release v0.1.0 2020-11-20 16:35:07 +05:00
Timur Demin
2d55d4f1e6
Add CI config and pkg.go.dev link 2020-11-20 16:20:06 +05:00
Timur Demin
2211c5ffdd
Prevent rendering _index.gmi.md as posts 2020-11-20 04:17:20 +05:00
Timur Demin
1f5257ac90
Fix rendering of links-only paragraphs 2020-11-20 03:59:45 +05:00
Timur Demin
421a40783c
Use gmnhg/ instead of layouts/gmnhg/
Unfortunately, Hugo will try to parse every template file in layouts/,
so we have to reside somewhere else.
2020-11-19 21:16:36 +05:00
Timur Demin
9d16372487
Implement sourcing _index.md content
Fixes #5. The Markdown content is sourced from _index.gmi.md so we don't
interfere with native Web content.
2020-11-19 21:12:59 +05:00
Timur Demin
0a62f8142c
Fix single template not being sourced 2020-11-19 04:30:37 +05:00
Timur Demin
6859f3d57c
Fix panic on draft posts 2020-11-19 03:32:55 +05:00
Timur Demin
b660e0b1da
Rewrite README with info on gmnhg 2020-11-19 03:27:03 +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
1a0e61dc3f
Implement gmnhg
gmnhg is the new program that generates a Gemini site from Hugo site
content. It reads its input from content/, static/, and layouts/gmnhg/.
Its output by default goes to output/.

More doc is available in the program doc header.
2020-11-18 22:23:31 +05:00
Timur Demin
8226a20880
Change API for simpler use by gmnhg 2020-11-11 23:21:18 +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
637ff4b71b
Rid of an unneeded check
RenderMarkdown doesn't really need an extra check on whether or not the
Markdown content size is more than a specific amount.
2020-11-11 23:21:17 +05:00
Timur Demin
9ea608670f
Clarify the subset of front matter data rendered 2020-11-11 23:21:17 +05:00
Timur Demin
adf921d2a5
Update TODO in README 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
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
4763bf11bc
Prepare first public release
At this stage, the repo contains:

* a functional Markdown -> Gemini converter
* a program md2gmn that provides an interface to the converter for
  testing purposes
2020-11-08 18:28:32 +05:00
Timur Demin
9bc1f8ef61
Add README and license code under GPLv3 2020-11-08 18:27:38 +05:00
Timur Demin
179a20e0db
Provide a public APIThis also introduces a simple program, md2gmn, that is meant for testingthe renderer on Markdown files. Nonetheless, it can be used as astandalone tool as well. 2020-11-08 17:43:11 +05:00
Timur Demin
507ec6ad88
Ignore test files from Git 2020-11-08 17:38:15 +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
98d6ff6d5f
Add lists and subsequent link paras to test text 2020-11-08 00:06:43 +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
Timur Demin
ff6ab83130
Add gigignore 2020-11-06 13:46:40 +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