Update README

This commit is contained in:
Alex Yatskov 2024-03-04 20:22:21 -08:00
parent 5c547dbf68
commit 8ee5f529d8

View File

@ -14,17 +14,17 @@ to understand, it is often best to learn by example:
1. Start by copying files from a source directory to a destination directory (the simplest possible use case): 1. Start by copying files from a source directory to a destination directory (the simplest possible use case):
```go ```go
goldsmith. var gs goldsmith.Goldsmith
Begin(srcDir). // read files from srcDir gs.Begin(srcDir). // read files from srcDir
End(dstDir) // write files to dstDir End(dstDir) // write files to dstDir
``` ```
2. Now let's convert any Markdown files to HTML fragments (while still copying the rest), using the 2. Now let's convert any Markdown files to HTML fragments (while still copying the rest), using the
[Markdown](https://godoc.org/git.foosoft.net/alex/goldsmith-components/plugins/markdown) plugin: [Markdown](https://godoc.org/git.foosoft.net/alex/goldsmith-components/plugins/markdown) plugin:
```go ```go
goldsmith. var gs goldsmith.Goldsmith
Begin(srcDir). // read files from srcDir gs.Begin(srcDir). // read files from srcDir
Chain(markdown.New()). // convert *.md files to *.html files Chain(markdown.New()). // convert *.md files to *.html files
End(dstDir) // write files to dstDir End(dstDir) // write files to dstDir
``` ```
@ -35,8 +35,8 @@ to understand, it is often best to learn by example:
[FrontMatter](https://godoc.org/git.foosoft.net/alex/goldsmith-components/plugins/frontmatter) plugin: [FrontMatter](https://godoc.org/git.foosoft.net/alex/goldsmith-components/plugins/frontmatter) plugin:
```go ```go
goldsmith. var gs goldsmith.Goldsmith
Begin(srcDir). // read files from srcDir gs.Begin(srcDir). // read files from srcDir
Chain(frontmatter.New()). // extract frontmatter and store it as metadata Chain(frontmatter.New()). // extract frontmatter and store it as metadata
Chain(markdown.New()). // convert *.md files to *.html files Chain(markdown.New()). // convert *.md files to *.html files
End(dstDir) // write files to dstDir End(dstDir) // write files to dstDir
@ -48,8 +48,8 @@ to understand, it is often best to learn by example:
[Layout](https://godoc.org/git.foosoft.net/alex/goldsmith-components/plugins/frontmatter) plugin: [Layout](https://godoc.org/git.foosoft.net/alex/goldsmith-components/plugins/frontmatter) plugin:
```go ```go
goldsmith. var gs goldsmith.Goldsmith
Begin(srcDir). // read files from srcDir gs.Begin(srcDir). // read files from srcDir
Chain(frontmatter.New()). // extract frontmatter and store it as metadata Chain(frontmatter.New()). // extract frontmatter and store it as metadata
Chain(markdown.New()). // convert *.md files to *.html files Chain(markdown.New()). // convert *.md files to *.html files
Chain(layout.New()). // apply *.gohtml templates to *.html files Chain(layout.New()). // apply *.gohtml templates to *.html files
@ -61,8 +61,8 @@ to understand, it is often best to learn by example:
[Minify](https://godoc.org/git.foosoft.net/alex/goldsmith-components/plugins/minify) plugin: [Minify](https://godoc.org/git.foosoft.net/alex/goldsmith-components/plugins/minify) plugin:
```go ```go
goldsmith. var gs goldsmith.Goldsmith
Begin(srcDir). // read files from srcDir gs.Begin(srcDir). // read files from srcDir
Chain(frontmatter.New()). // extract frontmatter and store it as metadata Chain(frontmatter.New()). // extract frontmatter and store it as metadata
Chain(markdown.New()). // convert *.md files to *.html files Chain(markdown.New()). // convert *.md files to *.html files
Chain(layout.New()). // apply *.gohtml templates to *.html files Chain(layout.New()). // apply *.gohtml templates to *.html files
@ -75,8 +75,8 @@ to understand, it is often best to learn by example:
minification occur only when we are ready for distribution. minification occur only when we are ready for distribution.
```go ```go
goldsmith. var gs goldsmith.Goldsmith
Begin(srcDir). // read files from srcDir gs.Begin(srcDir). // read files from srcDir
Chain(frontmatter.New()). // extract frontmatter and store it as metadata Chain(frontmatter.New()). // extract frontmatter and store it as metadata
Chain(markdown.New()). // convert *.md files to *.html files Chain(markdown.New()). // convert *.md files to *.html files
Chain(layout.New()). // apply *.gohtml templates to *.html files Chain(layout.New()). // apply *.gohtml templates to *.html files
@ -111,8 +111,8 @@ to understand, it is often best to learn by example:
} }
func (b *builder) Build(srcDir, dstDir, cacheDir string) { func (b *builder) Build(srcDir, dstDir, cacheDir string) {
errs := goldsmith. var gs goldsmith.Goldsmith
Begin(srcDir). // read files from srcDir errs := gs.Begin(srcDir). // read files from srcDir
Chain(frontmatter.New()). // extract frontmatter and store it as metadata Chain(frontmatter.New()). // extract frontmatter and store it as metadata
Chain(markdown.New()). // convert *.md files to *.html files Chain(markdown.New()). // convert *.md files to *.html files
Chain(layout.New()). // apply *.gohtml templates to *.html files Chain(layout.New()). // apply *.gohtml templates to *.html files