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

[gatsby-transformer-remark] excerpt not working for non-English content #6916

Closed
ipy opened this issue Jul 31, 2018 · 2 comments · Fixed by #6992
Closed

[gatsby-transformer-remark] excerpt not working for non-English content #6916

ipy opened this issue Jul 31, 2018 · 2 comments · Fixed by #6992
Labels
status: needs more info Needs triaging and reproducible examples or more information to be resolved

Comments

@ipy
Copy link

ipy commented Jul 31, 2018

Description

If the post doesn't contain a \w character, e.g. all characters are Chinese, the generated excerpt will contain nothing but '…'.
It's actually a bug of underscore.string: esamattis/underscore.string#418

@Chuloo
Copy link
Contributor

Chuloo commented Aug 1, 2018

@ipy can you provide more info on the supposed bug, possibly create a reproduction? Look through the issue template for a guide. 👍

@Chuloo Chuloo added the status: needs more info Needs triaging and reproducible examples or more information to be resolved label Aug 1, 2018
@ipy
Copy link
Author

ipy commented Aug 1, 2018

Description

When the markdown main body starts with non-English characters(\W, not [a-zA-Z0-9]), the generated excerpt by gatsby-transformer-remark contains nothing but '…'.

Steps to reproduce

Start a new blog:

gatsby new gatsby-blog https://github.com/gatsbyjs/gatsby-starter-blog
gatsby develop

Change the content to 咸鸭蛋很好吃。 and repeat it:
image

Check the result:
image

Expected result

Should be:

咸鸭蛋很好吃。 咸鸭蛋很好吃。 咸鸭蛋很好吃。 咸鸭蛋很好吃。 咸鸭蛋很好吃。 咸鸭蛋很好吃。 咸鸭蛋很好吃。 咸鸭蛋很好吃。 咸鸭蛋很好吃。 咸鸭蛋很好吃。 咸鸭蛋很好吃。 咸鸭蛋很好吃。 咸鸭蛋很好吃。 咸鸭蛋很好吃。 咸鸭蛋很好吃。 咸鸭蛋很好吃。 咸鸭蛋很好吃。 咸鸭蛋很…

Actual result

As seen in the image above, only generated.

Environment

System:
OS: Windows 10
CPU: x64 Intel(R) Core(TM) i5-4690 CPU @ 3.50GHz
Binaries:
Yarn: 1.3.2 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 5.3.0 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: 41.16299.492.0
npmPackages:
gatsby: ^1.9.250 => 1.9.277
gatsby-link: ^1.6.39 => 1.6.46
gatsby-plugin-feed: ^1.3.20 => 1.3.25
gatsby-plugin-google-analytics: ^1.0.29 => 1.0.31
gatsby-plugin-offline: ^1.0.15 => 1.0.18
gatsby-plugin-react-helmet: ^1.0.8 => 1.0.8
gatsby-plugin-sharp: ^1.6.42 => 1.6.48
gatsby-plugin-typography: ^1.7.18 => 1.7.19
gatsby-remark-copy-linked-files: ^1.5.31 => 1.5.37
gatsby-remark-images: ^1.5.61 => 1.5.67
gatsby-remark-prismjs: ^1.2.24 => 1.2.24
gatsby-remark-responsive-iframe: ^1.4.18 => 1.4.20
gatsby-remark-smartypants: ^1.4.12 => 1.4.12
gatsby-source-filesystem: ^1.5.31 => 1.5.39
gatsby-transformer-remark: ^1.7.40 => 1.7.44
gatsby-transformer-sharp: ^1.6.22 => 1.6.27

File contents (if changed)

gatsby-config.js: N/A
package.json: N/A
gatsby-node.js: N/A
gatsby-browser.js: N/A
gatsby-ssr.js: N/A

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs more info Needs triaging and reproducible examples or more information to be resolved
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants