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 -t, --posttitle string Title displayed in the generated image
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 -s, --subtitle string Subtitle displayed in the generated image
45
46example: p2c -i input.md -o output.png
47
48p2c is meant for use with Hugo.
49
50It looks at...
51- The Markdown file's frontmatter fields for
52 - title
53 - date
54- The site's config.{toml/yaml/yml} fields for
55 - title (site title)
56- The file's last modification date according to
57 the git history, falling back to the filesystem
58 metadata if git history is not available
59```
60
61[goreportcard-badge]: https://goreportcard.com/badge/git.sr.ht/~amolith/p2c
62[goreportcard]: https://goreportcard.com/report/git.sr.ht/~amolith/p2c
63[reuse]: https://api.reuse.software/info/git.sr.ht/~amolith/p2c
64[reuse-shield]: https://shields.io/reuse/compliance/git.sr.ht/~amolith/p2c
65[fosspay]: https://secluded.site/donate/
66[fosspay-shield]: https://shields.io/badge/donate-fosspay-yellow
67[scratchanitch-badge]: https://img.shields.io/badge/scratchanitch-dev-FFC4B5
68[scratchanitch]: https://scratchanitch.dev