Fixed notes on read page

This commit is contained in:
2025-11-28 16:52:52 +00:00
parent 18cc9d328d
commit 651b57be85
4 changed files with 70 additions and 5 deletions

View File

@@ -15,9 +15,11 @@ def readBook():
filepath = request.args.get('filepath')+"/book.md"
with open(filepath) as f:
mdtext = f.read()
notespath = request.args.get('filepath')+"/notes.txt"
with open(notespath) as f:
notestext = f.read()
renderedMd = markdown.markdown(mdtext)
finalHTML = "<a href='http://localhost:5000/'>Home</a>" + renderedMd
return finalHTML
return render_template('read.html', markdown=renderedMd, path=request.args.get('filepath'), notes=notestext)
@app.route('/notes')
def notesForBook():
@@ -28,7 +30,7 @@ def notesForBook():
@app.route('/savenotes', methods=['POST'])
def saveNotes():
path = request.form.get("path")
path = request.form.get("path")+"/notes.txt"
notes = request.form.get("notes")
with open(path, "w") as f:
f.write(notes)