markdown conversion added
This commit is contained in:
Generated
+13
-1
@@ -25,6 +25,18 @@
|
|||||||
revision = "fc9e8d8ef48496124e79ae0df75490096eccf6fe"
|
revision = "fc9e8d8ef48496124e79ae0df75490096eccf6fe"
|
||||||
version = "v0.0.2"
|
version = "v0.0.2"
|
||||||
|
|
||||||
|
[[projects]]
|
||||||
|
name = "github.com/russross/blackfriday"
|
||||||
|
packages = ["."]
|
||||||
|
revision = "cadec560ec52d93835bf2f15bd794700d3a2473b"
|
||||||
|
version = "v2.0.0"
|
||||||
|
|
||||||
|
[[projects]]
|
||||||
|
branch = "master"
|
||||||
|
name = "github.com/shurcooL/sanitized_anchor_name"
|
||||||
|
packages = ["."]
|
||||||
|
revision = "541ff5ee47f1dddf6a5281af78307d921524bcb5"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
branch = "master"
|
branch = "master"
|
||||||
name = "github.com/valyala/bytebufferpool"
|
name = "github.com/valyala/bytebufferpool"
|
||||||
@@ -52,6 +64,6 @@
|
|||||||
[solve-meta]
|
[solve-meta]
|
||||||
analyzer-name = "dep"
|
analyzer-name = "dep"
|
||||||
analyzer-version = 1
|
analyzer-version = 1
|
||||||
inputs-digest = "e1534696ddba3fee15190f7971602342df68b7eba8217a1438fd7dd150d82ba1"
|
inputs-digest = "a39fe24a6fa292ee2a7c5dabd94c32271f0c0cc16d928c8f1113600c76fb6d1f"
|
||||||
solver-name = "gps-cdcl"
|
solver-name = "gps-cdcl"
|
||||||
solver-version = 1
|
solver-version = 1
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
[[constraint]]
|
[[constraint]]
|
||||||
name = "github.com/labstack/echo"
|
name = "github.com/labstack/echo"
|
||||||
version = "3.1.0"
|
version = "3.1.0"
|
||||||
|
|
||||||
|
[[constraint]]
|
||||||
|
name = "github.com/russross/blackfriday"
|
||||||
|
version = "2.0.0"
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/labstack/echo"
|
"github.com/labstack/echo"
|
||||||
|
"github.com/russross/blackfriday"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@@ -11,8 +13,21 @@ func main() {
|
|||||||
|
|
||||||
e.Static("/", "assets/public")
|
e.Static("/", "assets/public")
|
||||||
|
|
||||||
|
e.GET("/Demo.md", func(c echo.Context) error { return c.String(http.StatusOK, mdPage(c, "Demo")) })
|
||||||
|
e.GET("/TOS.md", func(c echo.Context) error { return c.String(http.StatusOK, mdPage(c, "TOS")) })
|
||||||
|
|
||||||
e.GET("/", func(c echo.Context) error {
|
e.GET("/", func(c echo.Context) error {
|
||||||
return c.String(http.StatusOK, "Hello, World!")
|
return c.String(http.StatusOK, "Hello, World!")
|
||||||
})
|
})
|
||||||
e.Logger.Fatal(e.Start(":3000"))
|
e.Logger.Fatal(e.Start(":3000"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func mdPage(c echo.Context, name string) string {
|
||||||
|
path := "assets/markdown/" + name + ".md"
|
||||||
|
mdContent, err := ioutil.ReadFile(path)
|
||||||
|
if err != nil {
|
||||||
|
c.Logger().Errorf("couldn't open markdown page %q: %v", path, err)
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return string(blackfriday.Run(mdContent))
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user