-
Notifications
You must be signed in to change notification settings - Fork 194
fix: #337 add file name transfrom #338
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
Conversation
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Sorry for the delay. I hope to get a chance to look into this soon! 🙏 |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
up |
Thanks a lot for this PR @StringKe. I agree that we should try to address the underlaying issue (as described in #337), however, the transliteration package seems to add 1.6MB of dependencies which I'm wary to add. Maybe you (or someone else) is aware of a way to accomplish the same but using more standardised platform APIs? |
hi, @schickling I also have another method Use unicode as filename, this does not add extra volume but is already unreadable for filenames and the generated url is not friendly enough to read and remember.
|
I see. Let me see whether I can think of some kind of "user-configuration" way to enable the use case above. |
I favor using this approach by providing a |
Close, there has been another result. |
@StringKe What do you mean by "there has been another result"? Is there any workaround to this problem? |
I am currently a Flowershow user and I cannot use Chinese in file names because it depends on Contentlayer |
You can modify the specified files with In the long run, you still need this repository to support custom filename conversions |
I also meet the same problem and tried some solutions. Here is my solution. I add a import hash from 'hash-sum' And change this line of code
To const makeVariableName = flow(hash, idToFileName, (_) => camelCase(_, { stripRegexp: /[^A-Z0-9\_]/gi })) Or don't add any package. Change code to const makeVariableName = flow((_) => Buffer.from(_).toString('base64'), idToFileName, (_) => camelCase(_, { stripRegexp: /[^A-Z0-9\_]/gi })); But this may lead to variable names that are too long. Or like #431 change regular expression, add Chinese to it, use Chinese variable names. const makeVariableName = flow(idToFileName, (_) => camelCase(_, { stripRegexp: /[^\u4e00-\u9fa5A-Z0-9\_]/gi })); |
fix: #337
Use
transliteration
for filenames in other languages.