Skip to content

Conversation

@backyardaussie
Copy link

@backyardaussie backyardaussie commented Dec 9, 2025

MKdocs and Zensical allow for an edit button on the page. When configured to use NoteDiscovery as the editor, the URL contains the full files name with extension .md

This PR checks if the URL entered contains the notes file extension .md, and if so removes the .md from URL

Screenshot 2025-12-09 at 7 49 25 pm

If the URL entered contains the notes file extension, remove the .md from URL
@gamosoft
Copy link
Owner

gamosoft commented Dec 9, 2025

Thanks for the suggestion! I understand the use case with MKdocs/Zensical, however if possible I'd like the app to behave consistently, one single canonical URL to open notes (/folder/notename) so not to have special cases to handle on URLs, plus avoids edge cases of special naming that may arise. This keeps NoteDiscovery's URL structure clean.

Is there any way you can customize the URL call to strip the file extension it via some kind of plugin or similar?

On another note, the solution could be something like:

// In loadNoteFromURL()
let path = window.location.pathname;
if (path.endsWith('.md')) {
    path = path.slice(0, -3);
}

But again I'm a bit hesitant to have both paths there, but everything can be considered...

@backyardaussie
Copy link
Author

backyardaussie commented Dec 9, 2025

That's exactly what the PR does. It removes from the URL the .md if there. That's all it does. It doesn't change any function in the app at all

But instead of IF it's already implied by the removesuffix

@gamosoft
Copy link
Owner

Hmmm, ok, I will add this as a convenience but the removesuffix method is python code, I cannot use your PR here, I'll have to use an approach as depicted in my previous response. 😉

Let me close this and I will implement it together with the syntax highlight which is almost done/

@gamosoft gamosoft closed this Dec 10, 2025
@backyardaussie
Copy link
Author

OMG.. I just realised, it was 11pm when I did it so I was tired, that its a JS file and not python.. makes way more sense now with what you said

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants