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 (it also expects the site to be a
29 git repository)
30 - **Example:** `p2c -i content/posts/post.md -o public/post/cover.png`
31
32```
33❯ p2c -h
34
35Usage: p2c [options]
36
37Options:
38 -h, --help Show the help message
39 -i, --input string Path to input Markdown
40 -m, --metasize int Size of font for meta information (default 40)
41 -o, --output string Path to output PNG
42 -p, --posttitlesize int Size of font for post title (default 60)
43 -s, --sitetitlesize int Size of font for site title (default 50)
44
45example: p2c -i content/posts/post.md -o public/post/cover.png
46
47p2c is meant for use with Hugo.
48
49It looks at...
50- Markdown file's frontmatter fields for
51 - title
52 - date
53- Site's config.{toml/yaml/yml} fields for
54 - title (site title)
55- Git history to determine the date the post was last edited.
56```
57
58[goreportcard-badge]: https://goreportcard.com/badge/git.sr.ht/~amolith/p2c
59[goreportcard]: https://goreportcard.com/report/git.sr.ht/~amolith/p2c
60[reuse]: https://api.reuse.software/info/git.sr.ht/~amolith/p2c
61[reuse-shield]: https://shields.io/reuse/compliance/git.sr.ht/~amolith/p2c
62[fosspay]: https://secluded.site/donate/
63[fosspay-shield]: https://shields.io/badge/donate-fosspay-yellow
64[scratchanitch-badge]: https://img.shields.io/badge/scratchanitch-dev-FFC4B5
65[scratchanitch]: https://scratchanitch.dev