diff --git a/notes/file.go b/notes/file.go index 23d8971..c75b2b8 100755 --- a/notes/file.go +++ b/notes/file.go @@ -115,7 +115,7 @@ func (n *Notes) commentFormer(urlPath string, md []byte) html.RenderNodeFunc { } } return func(w io.Writer, node ast.Node, entering bool) (ast.WalkStatus, bool) { - if heading, ok := node.(*ast.Heading); ok && !entering { + if heading, ok := node.(*ast.Heading); !n.ro && ok && !entering { nextHeader() fmt.Fprintf(w, `
diff --git a/notes/notes.go b/notes/notes.go index 7a676ab..ccc144d 100755 --- a/notes/notes.go +++ b/notes/notes.go @@ -4,10 +4,12 @@ import "local/notes-server/config" type Notes struct { root string + ro bool } func New() *Notes { return &Notes{ root: config.Root, + ro: config.ReadOnly, } }