pass img type and size

This commit is contained in:
Antoni Sawicki
2024-07-08 21:46:47 -07:00
parent db4ed0d811
commit bb29ce38de

2
txt.go
View File

@@ -171,7 +171,7 @@ type astTransformer struct {
func (t *astTransformer) Transform(node *ast.Document, reader text.Reader, pc parser.Context) {
ast.Walk(node, func(n ast.Node, entering bool) (ast.WalkStatus, error) {
if link, ok := n.(*ast.Link); ok && entering {
link.Destination = append([]byte("/?t=txt&url="), link.Destination...)
link.Destination = append([]byte("/?m=html&t="+t.imgType+"&s="+strconv.Itoa(t.maxSize)+"&url="), link.Destination...)
}
if img, ok := n.(*ast.Image); ok && entering {
// TODO: dynamic extension based on form value