1<!--
2SPDX-FileCopyrightText: Amolith <amolith@secluded.site>
3
4SPDX-License-Identifier: CC0-1.0
5-->
6
7# p2c
8
9[![Go report card status][goreportcard-badge]][goreportcard]
10[![REUSE status][reuse-shield]][reuse]
11[![Donate with fosspay][fosspay-shield]][fosspay]
12[![scratchanitch.dev badge][scratchanitch-badge]][scratchanitch]
13
14_Generate cover images from Hugo posts_
15
16## Usage
17
18- Clone the repository
19- Create a directory in the repository named `fonts`
20- Copy four OpenType font files into the directory
21 - `regular.otf`
22 - `italic.otf`
23 - `bold.otf`
24 - `bold-italic.otf`
25- Install the [go toolchain](https://go.dev/doc/install)
26- Run `go install .`
27 - This bundles your selected fonts into the binary
28- Run the tool from the root of your Hugo site
29 - **Example:** `p2c -i content/posts/post.md -o public/post/cover.png`
30
31```
32❯ p2c -h
33
34Usage: p2c [options]
35
36Options:
37 -h, --help Show the help message
38 -i, --input string Path to input Markdown
39 -m, --metasize int Size of font for meta information (default 40)
40 -o, --output string Path to output PNG
41 -p, --posttitlesize int Size of font for post title (default 60)
42 -s, --sitetitlesize int Size of font for site title (default 50)
43
44example: p2c -i content/posts/post.md -o public/post/cover.png
45
46p2c is meant for use with Hugo.
47
48It looks at...
49- Markdown file's frontmatter fields for
50 - title
51 - date
52- Site's config.{toml/yaml/yml} fields for
53 - title (site title)
54- The file's metadata for the last modified date
55```
56
57[goreportcard-badge]: https://goreportcard.com/badge/git.sr.ht/~amolith/p2c
58[goreportcard]: https://goreportcard.com/report/git.sr.ht/~amolith/p2c
59[reuse]: https://api.reuse.software/info/git.sr.ht/~amolith/p2c
60[reuse-shield]: https://shields.io/reuse/compliance/git.sr.ht/~amolith/p2c
61[fosspay]: https://secluded.site/donate/
62[fosspay-shield]: https://shields.io/badge/donate-fosspay-yellow
63[scratchanitch-badge]: https://img.shields.io/badge/scratchanitch-dev-FFC4B5
64[scratchanitch]: https://scratchanitch.dev