diff --git a/page.go b/page.go index 849d97b..df44845 100755 --- a/page.go +++ b/page.go @@ -8,6 +8,7 @@ import ( "regexp" "sort" "strings" + "sync" "time" "github.com/schollz/versionedtext" @@ -107,7 +108,11 @@ func (p *Page) Render() { p.RenderedPage = MarkdownToHtml(p.Text.GetCurrent()) } +var saveMut = sync.Mutex{} + func (p *Page) Save() error { + saveMut.Lock() + defer saveMut.Unlock() bJSON, err := json.MarshalIndent(p, "", " ") if err != nil { return err