~aw/fishbb

e792be467e266019ac1d5bf617f97c912d14953a — alex wennerberg a month ago 9f07f3c
markdown parser instead of gmi
1 files changed, 25 insertions(+), 0 deletions(-)

A markdown.go
A markdown.go => markdown.go +25 -0
@@ 0,0 1,25 @@
package main

import (
	"bytes"
	"html/template"

	"github.com/yuin/goldmark"
)

var md = goldmark.New()

func (p Post) Render() template.HTML {
	var out bytes.Buffer
	md.Convert([]byte(p.Content), &out)
	return template.HTML(out.String())
}

// @user -> username
// #post -> post

func (p Post) BuildReply() string {
	// naive solution: prefix everything?
	// User [@username](/u/username) wrote ...
	return p.Content
}