This commit is contained in:
parent
594f7ab96c
commit
4f6c87c14e
|
@ -4,8 +4,10 @@ import (
|
|||
"encoding/json"
|
||||
"fmt"
|
||||
"html/template"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strings"
|
||||
)
|
||||
|
||||
|
@ -111,6 +113,13 @@ func getBackrefs(fp *FilePages, p string) (map[string][]Backref, error) {
|
|||
if line[0] == '*' && line[1] == ' ' {
|
||||
line = line[2:]
|
||||
}
|
||||
|
||||
metaKV, err := regexp.Compile(`(\w+)::\s+(.*)`)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
line = metaKV.ReplaceAllString(line, "**[[$1]]**: $2")
|
||||
|
||||
links := renderLinks(line)
|
||||
pageText := renderMarkdown2(links)
|
||||
|
||||
|
|
|
@ -211,7 +211,7 @@ if (holder) {
|
|||
converted = MD.render(converted)
|
||||
} else {
|
||||
if (text.match(/^(\w+):: (.+)$/)) {
|
||||
converted = converted.replace(/^(\w+):: (.*)$/, '**$1**: $2')
|
||||
converted = converted.replace(/^(\w+):: (.*)$/, '**[[$1]]**: $2')
|
||||
} else if (text.match(/#\[\[TODO]]/)) {
|
||||
converted = converted.replace('#[[TODO]]', '<input class="checkbox" type="checkbox" />')
|
||||
} else if (text.match(/#\[\[DONE]]/)) {
|
||||
|
|
6
main.go
6
main.go
|
@ -683,6 +683,12 @@ func (h *indexHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
|
||||
if format == "html" {
|
||||
metaKV, err := regexp.Compile(`(\w+)::\s+(.*)`)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
pageText = metaKV.ReplaceAllString(pageText, "**[[$1]]**: $2")
|
||||
|
||||
pageText = renderLinks(pageText)
|
||||
pageText = renderMarkdown2(pageText)
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ func renderMarkdown2(pageText string) string {
|
|||
html.WithUnsafe(),
|
||||
),
|
||||
)
|
||||
|
||||
var buf bytes.Buffer
|
||||
if err := md.Convert([]byte(pageText), &buf); err != nil {
|
||||
panic(err)
|
||||
|
|
|
@ -17,7 +17,8 @@
|
|||
}
|
||||
#autocomplete {
|
||||
z-index: 1;
|
||||
width: 217px;
|
||||
right: 0;
|
||||
width: 400px;
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
height: 300px;
|
||||
|
|
Loading…
Reference in New Issue
Block a user