improve docs

This commit is contained in:
dre 2021-07-11 01:29:02 +08:00
parent 4947b7123e
commit 56e88a5686
2 changed files with 19 additions and 6 deletions

View file

@ -4,16 +4,28 @@ Utility to parse a hugo config file and create the same file structure for conte
arbitrary output pipe extension. arbitrary output pipe extension.
Hugo parses primarily markdown files and go templates. The initial motivation for this utility was Hugo parses primarily markdown files and go templates. The initial motivation for this utility was
to enable the same tools to publish a gemlog version of the same blog to make it accessible through to enable the same tools to publish a gemlog version of the same blog to make it accessible as
the Gemini protocol. gemtext via the Gemini protocol alongside the web html version.
**NOTE**: not many features, this is minimal and only has one use case for now. **NOTE**: this is minimal and only has one use case for now, many edge cases may not be covered.
Features Features
- reads hugo `.toml` file for section output formats - reads hugo `.toml` file for section output formats
- supports an arbitrary document processor, any program that supports UNIX pipes - supports an arbitrary document processor, any program that supports UNIX pipes
- ugly urls
- section listings
- with drafts
When the selected extension is blank, markdown files will be copied unmodified. To illustrate what this program does, run the following in the hugo directory.
```
hugoext -proc="" -ext txt
```
The markdown files from `./content` will be written as `.txt` files to the `./public` directory. We
can add a processor that converts markdown to a different extension and output the same directory
layout as hugo does. Here, when the selected processor is blank, markdown files will be copied
unmodified.
## Example Use ## Example Use
@ -24,6 +36,7 @@ gemtext. Executed from the hugo directory:
hugoext -ext gmi -pipe md2gmi hugoext -ext gmi -pipe md2gmi
``` ```
It abides the hugo section config in `[permalinks]` but only uses the content subdirectory to It abides the hugo section config in `[permalinks]` but only uses the content subdirectory to
determine the section. An example section config in hugo looks like this: determine the section. An example section config in hugo looks like this:

View file

@ -18,8 +18,8 @@ import (
) )
const ( const (
defaultExt = "gmi" defaultExt = "md"
defaultProcessor = "md2gmi" defaultProcessor = ""
defaultSource = "content" defaultSource = "content"
defaultDestination = "public" defaultDestination = "public"
defaultConfigPath = "config.toml" defaultConfigPath = "config.toml"