File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed
Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ func newMarkdownFS(p string) *markdownFS {
6060
6161 for {
6262 switch ei := <- events ; ei .Event () {
63- case notify .Write , notify .Remove , notify . Rename , notify .Create :
63+ case notify .Write , notify .Rename , notify .Create :
6464 relPath , err := filepath .Rel (absPath , ei .Path ())
6565 if err != nil {
6666 slog .Error ("Can't resolve relative path" , "error" , err )
@@ -77,9 +77,26 @@ func newMarkdownFS(p string) *markdownFS {
7777
7878 name := strings .TrimSuffix (relPath , ".md" )
7979 cp := m ._page (name )
80-
8180 Trigger (PageChanged , cp )
81+ m .cache .Remove (name )
82+ case notify .Remove :
83+ relPath , err := filepath .Rel (absPath , ei .Path ())
84+ if err != nil {
85+ slog .Error ("Can't resolve relative path" , "error" , err )
86+ continue
87+ }
8288
89+ if ! strings .HasSuffix (relPath , ".md" ) {
90+ continue
91+ }
92+
93+ if IsIgnoredPath (relPath ) {
94+ continue
95+ }
96+
97+ name := strings .TrimSuffix (relPath , ".md" )
98+ cp := m ._page (name )
99+ Trigger (PageDeleted , cp )
83100 m .cache .Remove (name )
84101 }
85102 }
You can’t perform that action at this time.
0 commit comments