mirror of
https://github.com/schollz/cowyo.git
synced 2023-08-10 21:13:00 +03:00
Can simply view with [[Something]]
Former-commit-id: a737e4503380c60be58f7737a87cd79944b2ca47 [formerly ad79f72f0f5780255717c0b9c2f6005407a55712] [formerly 643df8a690b674bf9c3972d95097ed9c0330ba81 [formerly 92a102398dc9a94b75b5f690d1ebac57a88935ef [formerly01a91422d9
]]] Former-commit-id: 712034514db1c8402f02cc17670425e76af153f1 [formerly b7f903ac993bff3bbb4d7d6ea9a2439cc942e22b] Former-commit-id: 7f15b334a309663b4ade99ee2b65e3f7b247a698 Former-commit-id:0f6db92a95
This commit is contained in:
parent
b09f2b71c8
commit
aa4a05cad4
@ -11,7 +11,7 @@ This is a self-contained wiki webserver that makes sharing easy and _fast_. You
|
||||
To jot a note, simply load the page at [`/`](http://AwwKoala.com/) and just start typing. No need to press edit, the browser will already be focused on the text. No need to press save - it will automatically save when you stop writing. The URL at [`/`](http://AwwKoala.com/) will redirect to an easy-to-remember name that you can use to reload the page at anytime, anywhere. But, you can also use any URL you want, e.g. [`/AnythingYouWant`](http://AwwKoala.com/AnythingYouWant).
|
||||
|
||||
## Views
|
||||
All pages can be rendered into HTML by adding `/view`. For example, the page [`/AnythingYouWant`](http://AwwKoala.com/AnythingYouWant) is rendered at [`/AnythingYouWant/view`](http://AwwKoala.com/AnythingYouWant/view). You can write in HTML or [Markdown](https://daringfireball.net/projects/markdown/) for page rendering. Math is supported with [Katex](https://github.com/Khan/KaTeX) using `$\frac{1}{2}$` for inline equations and `$$\frac{1}{2}$$` for regular equations.
|
||||
All pages can be rendered into HTML by adding `/view`. For example, the page [`/AnythingYouWant`](http://AwwKoala.com/AnythingYouWant) is rendered at [`/AnythingYouWant/view`](http://AwwKoala.com/AnythingYouWant/view). You can write in HTML or [Markdown](https://daringfireball.net/projects/markdown/) for page rendering. To quickly link to `/view` pages, just use `[[AnythingYouWnat]]`. Math is supported with [Katex](https://github.com/Khan/KaTeX) using `$\frac{1}{2}$` for inline equations and `$$\frac{1}{2}$$` for regular equations.
|
||||
|
||||
## Lists
|
||||
If you are writing a list and you want to tick off things really easily, just add `/list`. For example, after editing [`/grocery`](http://AwwKoala.com/grocery), goto [`/grocery/list`](http://AwwKoala.com/grocery/list). In this page, whatever you click on will be striked through and moved to the end. This is helpful if you write a grocery list and then want to easily delete things from it.
|
||||
|
@ -94,6 +94,10 @@ func serveStaticFile(c *gin.Context, option string) {
|
||||
}
|
||||
|
||||
func renderMarkdown(c *gin.Context, currentText string, title string, versions []versionsInfo) {
|
||||
r, _ := regexp.Compile("\\[\\[(.*?)\\]\\]")
|
||||
for _, s := range r.FindAllString(currentText, -1) {
|
||||
currentText = strings.Replace(currentText, s, "["+s[2:len(s)-2]+"](/"+s[2:len(s)-2]+"/view)", 1)
|
||||
}
|
||||
unsafe := blackfriday.MarkdownCommon([]byte(currentText))
|
||||
pClean := bluemonday.UGCPolicy()
|
||||
pClean.AllowElements("img")
|
||||
@ -102,7 +106,7 @@ func renderMarkdown(c *gin.Context, currentText string, title string, versions [
|
||||
pClean.AllowDataURIImages()
|
||||
html := pClean.SanitizeBytes(unsafe)
|
||||
html2 := string(html)
|
||||
r, _ := regexp.Compile("\\$\\$(.*?)\\$\\$")
|
||||
r, _ = regexp.Compile("\\$\\$(.*?)\\$\\$")
|
||||
for _, s := range r.FindAllString(html2, -1) {
|
||||
html2 = strings.Replace(html2, s, "<span class='texp' data-expr='"+s[2:len(s)-2]+"'></span>", 1)
|
||||
}
|
||||
@ -112,6 +116,8 @@ func renderMarkdown(c *gin.Context, currentText string, title string, versions [
|
||||
}
|
||||
|
||||
html2 = strings.Replace(html2, "&#36;", "$", -1)
|
||||
html2 = strings.Replace(html2, "&#91;", "[", -1)
|
||||
html2 = strings.Replace(html2, "&#93;", "]", -1)
|
||||
c.HTML(http.StatusOK, "view.tmpl", gin.H{
|
||||
"Title": title,
|
||||
"WikiName": RuntimeArgs.WikiName,
|
||||
|
@ -11,7 +11,7 @@ This is a self-contained wiki webserver that makes sharing easy and _fast_. You
|
||||
To jot a note, simply load the page at [`/`](/) and just start typing. No need to press edit, the browser will already be focused on the text. No need to press save - it will automatically save when you stop writing. The URL at [`/`](/) will redirect to an easy-to-remember name that you can use to reload the page at anytime, anywhere. But, you can also use any URL you want, e.g. [`/AnythingYouWant`](/AnythingYouWant).
|
||||
|
||||
## Views
|
||||
All pages can be rendered into HTML by adding `/view`. For example, the page [`/AnythingYouWant`](/AnythingYouWant) is rendered at [`/AnythingYouWant/view`](/AnythingYouWant/view). You can write in HTML or [Markdown](https://daringfireball.net/projects/markdown/) for page rendering. Math is supported with [Katex](https://github.com/Khan/KaTeX) using `$\frac{1}{2}$` for inline equations and `$$\frac{1}{2}$$` for regular equations.
|
||||
All pages can be rendered into HTML by adding `/view`. For example, the page [`/AnythingYouWant`](/AnythingYouWant) is rendered at [`/AnythingYouWant/view`](/AnythingYouWant/view). You can write in HTML or [Markdown](https://daringfireball.net/projects/markdown/) for page rendering. To quickly link to `/view` pages, just use `[[AnythingYouWant]]`. Math is supported with [Katex](https://github.com/Khan/KaTeX) using `$\frac{1}{2}$` for inline equations and `$$\frac{1}{2}$$` for regular equations.
|
||||
|
||||
## Lists
|
||||
If you are writing a list and you want to tick off things really easily, just add `/list`. For example, after editing [`/grocery`](/grocery), goto [`/grocery/list`](/grocery/list). In this page, whatever you click on will be striked through and moved to the end. This is helpful if you write a grocery list and then want to easily delete things from it.
|
||||
|
Loading…
Reference in New Issue
Block a user