diff --git a/examples/full-app-gourmet/go.mod b/examples/full-app-gourmet/go.mod index 3a7acc59..d20dcd46 100644 --- a/examples/full-app-gourmet/go.mod +++ b/examples/full-app-gourmet/go.mod @@ -1,11 +1,12 @@ module github.com/go-fuego/fuego/examples/full-app-gourmet -go 1.22.2 +go 1.22.5 require ( github.com/a-h/templ v0.2.747 github.com/go-chi/chi/v5 v5.1.0 github.com/go-fuego/fuego v0.14.0-rc2 + github.com/go-fuego/fuego/extra/markdown v0.0.0-00010101000000-000000000000 github.com/golang-jwt/jwt/v5 v5.2.1 github.com/golang-migrate/migrate/v4 v4.17.1 github.com/google/uuid v1.6.0 @@ -57,3 +58,7 @@ require ( ) replace github.com/go-fuego/fuego => ../.. + +replace github.com/go-fuego/fuego/extra/markdown => ../../extra/markdown + +replace github.com/go-fuego/fuego/middleware/cache => ../../middleware/cache diff --git a/examples/full-app-gourmet/templa/recipe.page.templ b/examples/full-app-gourmet/templa/recipe.page.templ index 022f25ee..c172ea4a 100644 --- a/examples/full-app-gourmet/templa/recipe.page.templ +++ b/examples/full-app-gourmet/templa/recipe.page.templ @@ -4,9 +4,9 @@ import ( "strconv" "context" "io" + "github.com/go-fuego/fuego/extra/markdown" "github.com/go-fuego/fuego/examples/full-app-gourmet/store" "github.com/go-fuego/fuego/examples/full-app-gourmet/templa/components" - "github.com/go-fuego/fuego" ) func Unsafe(html string) templ.Component { @@ -144,7 +144,7 @@ templ RecipePage(props RecipePageProps, generalProps GeneralProps) {

Instructions

- @Unsafe(string(fuego.Markdown(props.Recipe.Instructions))) + @Unsafe(string(markdown.Markdown(props.Recipe.Instructions)))

diff --git a/examples/full-app-gourmet/views/recipe.go b/examples/full-app-gourmet/views/recipe.go index f2a93666..7a990cd2 100644 --- a/examples/full-app-gourmet/views/recipe.go +++ b/examples/full-app-gourmet/views/recipe.go @@ -13,6 +13,7 @@ import ( "github.com/go-fuego/fuego/examples/full-app-gourmet/static" "github.com/go-fuego/fuego/examples/full-app-gourmet/store" "github.com/go-fuego/fuego/examples/full-app-gourmet/templa" + "github.com/go-fuego/fuego/extra/markdown" "github.com/go-fuego/fuego" "github.com/google/uuid" @@ -274,7 +275,7 @@ func (rs Ressource) RecipePage(c fuego.ContextNoBody) (fuego.HTML, error) { return c.Render("pages/recipe.page.html", fuego.H{ "Recipe": recipe, "Ingredients": ingredients, - "Instructions": fuego.Markdown(recipe.Instructions), + "Instructions": markdown.Markdown(recipe.Instructions), }) } diff --git a/extra/markdown/go.mod b/extra/markdown/go.mod new file mode 100644 index 00000000..2364863b --- /dev/null +++ b/extra/markdown/go.mod @@ -0,0 +1,5 @@ +module github.com/go-fuego/fuego/extra/markdown + +go 1.22.5 + +require github.com/gomarkdown/markdown v0.0.0-20240626202925-2eda941fd024 diff --git a/extra/markdown/go.sum b/extra/markdown/go.sum new file mode 100644 index 00000000..b34977fc --- /dev/null +++ b/extra/markdown/go.sum @@ -0,0 +1,2 @@ +github.com/gomarkdown/markdown v0.0.0-20240626202925-2eda941fd024 h1:saBP362Qm7zDdDXqv61kI4rzhmLFq3Z1gx34xpl6cWE= +github.com/gomarkdown/markdown v0.0.0-20240626202925-2eda941fd024/go.mod h1:JDGcbDT52eL4fju3sZ4TeHGsQwhG9nbDV21aMyhwPoA= diff --git a/views.go b/extra/markdown/markdown.go similarity index 97% rename from views.go rename to extra/markdown/markdown.go index 203f5265..5bfbbab7 100644 --- a/views.go +++ b/extra/markdown/markdown.go @@ -1,4 +1,4 @@ -package fuego +package markdown import ( "html/template" diff --git a/views_test.go b/extra/markdown/markdown_test.go similarity index 96% rename from views_test.go rename to extra/markdown/markdown_test.go index 722e50ca..c402e9d8 100644 --- a/views_test.go +++ b/extra/markdown/markdown_test.go @@ -1,4 +1,4 @@ -package fuego +package markdown import ( "html/template" diff --git a/go.mod b/go.mod index c846691b..7baa7104 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,6 @@ require ( github.com/getkin/kin-openapi v0.123.0 github.com/go-playground/validator/v10 v10.19.0 github.com/golang-jwt/jwt/v5 v5.2.1 - github.com/gomarkdown/markdown v0.0.0-20231222211730-1d6d20845b47 github.com/gorilla/schema v1.4.1 github.com/hashicorp/golang-lru/v2 v2.0.7 github.com/stretchr/testify v1.9.0 diff --git a/go.sum b/go.sum index d79c4754..832563bd 100644 --- a/go.sum +++ b/go.sum @@ -20,8 +20,6 @@ github.com/go-test/deep v1.0.8 h1:TDsG77qcSprGbC6vTN8OuXp5g+J+b5Pcguhf7Zt61VM= github.com/go-test/deep v1.0.8/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE= github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= -github.com/gomarkdown/markdown v0.0.0-20231222211730-1d6d20845b47 h1:k4Tw0nt6lwro3Uin8eqoET7MDA4JnT8YgbCjc/g5E3k= -github.com/gomarkdown/markdown v0.0.0-20231222211730-1d6d20845b47/go.mod h1:JDGcbDT52eL4fju3sZ4TeHGsQwhG9nbDV21aMyhwPoA= github.com/gorilla/schema v1.4.1 h1:jUg5hUjCSDZpNGLuXQOgIWGdlgrIdYvgQ0wZtdK1M3E= github.com/gorilla/schema v1.4.1/go.mod h1:Dg5SSm5PV60mhF2NFaTV1xuYYj8tV8NOPRo4FggUMnM= github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= diff --git a/go.work b/go.work index dd2da0a1..948d740f 100644 --- a/go.work +++ b/go.work @@ -1,4 +1,4 @@ -go 1.22.4 +go 1.22.5 use ( . @@ -9,5 +9,6 @@ use ( ./examples/full-app-gourmet ./examples/hello-world ./examples/openapi + ./extra/markdown ./testing-from-outside )