Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exporting notes as Markdown or HTML truncates note filenames to 50 characters and sanitises some common characters used in naming #11012

Closed
mrjo118 opened this issue Sep 9, 2024 · 3 comments
Labels
bug It's a bug

Comments

@mrjo118
Copy link
Contributor

mrjo118 commented Sep 9, 2024

Operating system

Windows

Joplin version

3.0.15

Desktop version info

Joplin 3.0.15 (prod, win32)

Client ID: c71f0369bd0141998e181b08b552d78f
Sync Version: 3
Profile Version: 47
Keychain Supported: Yes

Revision: 598677b

Current behaviour

When exporting notes via the Markdown or HTML options, note names are truncated at 50 characters. Additionally, apostrophes and forward slashes and likely other characters included in note names, are replaced with underscore

Expected behaviour

Note names of 50 characters seems limited. If truncating is necessary, a higher limit would be better, or possibly the option to configure the length at which to truncate when exporting. It's understandable that some special characters cannot be used as filenames for the files, but apostrophes at least, seem a quite common character which might be included in note names and should be supported in filenames in all OS'

Logs

No response

@mrjo118 mrjo118 added the bug It's a bug label Sep 9, 2024
@mrjo118 mrjo118 changed the title Exporting notes as Markdown truncates note filenames to 50 characters and sanitises some common characters used in naming Exporting notes as Markdown or HTML truncates note filenames to 50 characters and sanitises some common characters used in naming Sep 9, 2024
@mrjo118 mrjo118 closed this as completed Sep 9, 2024
@mrjo118
Copy link
Contributor Author

mrjo118 commented Sep 9, 2024

Looks like this is by design and has been discussed already #5653

@n8henrie
Copy link

This is somewhat challenging, as my markdown links to PDF files are now linking to e.g. .pd files, which isn't a recognized file format obviously and therefore fails to open or preview as expected.

The HTML export format is much more usable (and uses some kind of UUID for the pdf filename, which I think is fair to avoid the above concerns regarding filename length and perhaps invalid chars). I wonder if the same strategy could be adapted for markdown export.

Currently: my long filename.pdf -> [my long filename.pdf](../_resources/my_long_filename.pd)
Proposed: [my long filename.pdf](../_resources/4B3461A9-DC9C-47AF-B12C-CE6968DF2801.pdf)

@n8henrie
Copy link

n8henrie commented Jan 10, 2025

I wrote a quick and dirty python script to mitigate this issue: https://gist.github.com/n8henrie/71138a5c86f21ffde1c919c5b99ed7b4

It essentially attempts to change [my long filename.pdf](../_resources/my_long_filename.pd) back to [my long filename.pdf](../_resources/my long filename.pdf) (and rename the referenced file accordingly) for the convenience of macos and linux users.

Of note, parentheses in filenames are handled differently by different markdown viewers, and I couldn't find a single strategy for escaping these that would consistently work across several viewers that I tried. I stuck with a simple backslash escape of closing parens in this case, but you may need to change the code to url encode the file path or enclose it in <> or follow one of many other strategies.

Hope this is useful for some of you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug It's a bug
Projects
None yet
Development

No branches or pull requests

2 participants