2022-10-17

I learned about Working Copy yesterday so I’m testing it now!

One issue on iOS is that two subsequent dashes are being converted into a single longer dash, which we don’t want. Getting the three dashes is a little awkward.

I was successfully able to clone my GitHub repo, make a new markdown file, and push my changes to trigger a new build. This does exactly what I want!

Earlier today I continued building “goliki”. I successfully added a custom ASTTransformer and walked the AST for each document to find Link nodes. I still need to transform the URLs themselves, but I think getting that transformer configured and working was the trickiest part of the code since the docs didn’t really cover how to do this. Sometimes you really do just have to read the code.

Uh oh, how do you get back ticks in iOS? Hold down the single-quote (‘) key for menu with similar keys, including back tick.

// https://pkg.go.dev/github.com/yuin/goldmark@v1.5.2/parser?utm_source=gopls#ASTTransformer
type SomeTransformer struct{}

// Transform transforms the provided Markdown AST.
// In this example we traverse the AST and print out the URL for each Link found.
func (*SomeTransformer) Transform(doc *ast.Document, reader text.Reader, pctx parser.Context) {
	ast.Walk(doc, func(node ast.Node, enter bool) (ast.WalkStatus, error) {
		
		if !enter {
			return ast.WalkContinue, nil
		}

		// check if node is a Link
		link, ok := node.(*ast.Link)
		if !ok {
			return ast.WalkContinue, nil
		}

		// do stuff, e.g. print url
		fmt.Println(string(link.Destination))

		// continue walking tree
		return ast.WalkContinue, nil
	})
}

// create new custom goldmark
markdown := goldmark.New(
	goldmark.WithParserOptions(
		parser.WithASTTransformers(
			util.Prioritized(&SomeTransformer{}, 100),
		),
	),
)

Next, I need to abstract and collect the YAML front matter for each file. See goldmark-meta.

Then, I need to write each final HTML file with file metadata and Markdown HTML. Metadata should specify template to use. I think I will use Go templates for now. See Using Go Templates, html/template.

Why am I doing much of this on iOS? I like it. It’s think it slows me down and allow me to focus, as things like context-switching are heavily restricted. Also MacBook is out of power since this fancy cafe doesn’t really have power outlets.

NOTE: The following link should not work unless you’re reading this in your code editor, Github, or if this content is now built using goliki: ai

OK! Things are kinda working but are not yet ready for an initial build. I need to:

After initial build I probably need to:

I really should figure out what data I’m passing around. I think I want to follow Hugo’s conventions for variables. I also need to think about how I want to organize my own goliki.