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

Support utf-8 title #51

Open
idealclover opened this issue Oct 18, 2020 · 3 comments
Open

Support utf-8 title #51

idealclover opened this issue Oct 18, 2020 · 3 comments

Comments

@idealclover
Copy link

Hi so glad to find this program! :)
I'm now using obsidian.md instead of roam. When trying to import from notes, problems were found.
I'm Chinese so my notes are named in Chinese. But the links containing Chinese could not open correctly. However, the reference links could be opened. Hope that this issue can be solved~
Another issue is that when an article has no title, there will be no title showed in web page, maybe the name of this file could be show here?
Thanks a lot!
图片

@idealclover idealclover changed the title Support other language Support utf-8 title Oct 23, 2020
@101scholar
Copy link

@idealclover In node_modules/gatsby-remark-double-brackets-link/lib/index.js, change ${slugify_1.default(title)}. The slugify plugin here will swallow chinese character. Find a plugin that supports your language, or if all file names do not contain special characters like SPACE simply replace it with ${title}.

Now you can jump to the right page. But it's not opened on the right side. This is because chinese in URI cannot match the local file name. To solve it, change withPrefix(x.slug) === withPrefix(href) to withPrefix(x.slug) === withPrefix(decodeURI(href)) in node_modules/gatsby-theme-garden/src/components/mdx-components/anchor-tag.js.

Now everything should work well.

@mathieudutour
Copy link
Owner

Happy to merge a PR if you found a slugify function that support chinese characters

@Stvad
Copy link

Stvad commented Mar 19, 2021

In https://roam.garden/ fork I resolved this by using a custom slugify wrapper that returns a sha1 hash of original title if the output of slugify is empty

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

No branches or pull requests

4 participants