this should work. added some icons and some more
This commit is contained in:
29
htmlhandler.py
Normal file
29
htmlhandler.py
Normal file
@@ -0,0 +1,29 @@
|
||||
from pathlib import Path
|
||||
from watchdog.events import FileSystemEventHandler
|
||||
|
||||
# this has to be like this. idk why. its ass
|
||||
|
||||
class htmlhandler(FileSystemEventHandler):
|
||||
def on_created(self, event):
|
||||
if not event.is_directory and event.src_path.endswith(".md"):
|
||||
import PyPost
|
||||
PyPost.render_markdown(Path(event.src_path))
|
||||
|
||||
def on_modified(self, event):
|
||||
if not event.is_directory and event.src_path.endswith(".md"):
|
||||
import PyPost
|
||||
PyPost.render_markdown(Path(event.src_path))
|
||||
|
||||
def on_deleted(self, event):
|
||||
if not event.is_directory and event.src_path.endswith(".md"):
|
||||
import PyPost
|
||||
PyPost.remove_html(Path(event.src_path))
|
||||
|
||||
def on_moved(self, event):
|
||||
src = Path(event.src_path)
|
||||
dest = Path(event.dest_path)
|
||||
import PyPost
|
||||
if src.suffix.lower() == ".md":
|
||||
PyPost.remove_html(src)
|
||||
if dest.suffix.lower() == ".md":
|
||||
PyPost.render_markdown(dest)
|
||||
Reference in New Issue
Block a user