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

图片块解析错误! #857

Closed
5 of 11 tasks
siaimes opened this issue Apr 29, 2019 · 23 comments
Closed
5 of 11 tasks

图片块解析错误! #857

siaimes opened this issue Apr 29, 2019 · 23 comments

Comments

@siaimes
Copy link

siaimes commented Apr 29, 2019

I agree and want to create new issue


示例代码

\`\`\`
1
\`\`\`
![2](3.jpg)

Expected behavior

1

[3.jpg]

Actual behavior

1

[3.jpg]
2

Steps to reproduce the behavior

Paste the code on any post to reproduce it!

  • Link to demo site with this bug: N/A
  • Link(s) to source code or any usefull link(s): N/A

Node.js and NPM Information

$ node -v && npm -v
v8.12.0
6.4.1

Package dependencies Information

$ cat package.json
{
  "name": "hexo-site",
  "version": "0.0.0",
  "private": true,
  "hexo": {
    "version": "3.8.0"
  },
  "dependencies": {
    "braces": "^3.0.1",
    "eslint": "^5.16.0",
    "hexo": "^3.8.0",
    "hexo-deployer-git": "^1.0.0",
    "hexo-deployer-rsync": "^0.1.3",
    "hexo-fs": "^1.0.2",
    "hexo-generator-archive": "^0.1.4",
    "hexo-generator-baidu-sitemap": "^0.1.6",
    "hexo-generator-category": "^0.1.3",
    "hexo-generator-index": "^0.2.0",
    "hexo-generator-search": "^2.2.5",
    "hexo-generator-sitemap": "^1.2.0",
    "hexo-generator-tag": "^0.2.0",
    "hexo-recommended-posts": "^1.0.3",
    "hexo-renderer-ejs": "^0.3.0",
    "hexo-renderer-pandoc": "^0.2.5",
    "hexo-renderer-stylus": "^0.3.1",
    "hexo-server": "^0.2.2"
  }
}

Hexo Information

Hexo version

$ hexo -v
hexo: 3.8.0
hexo-cli: 1.1.0
os: Windows_NT 10.0.17763 win32 x64
http_parser: 2.8.0
node: 8.12.0
v8: 6.2.414.66
uv: 1.19.2
zlib: 1.2.11
ares: 1.10.1-DEV
modules: 57
nghttp2: 1.32.0
napi: 3
openssl: 1.0.2p
icu: 60.1
unicode: 10.0
cldr: 32.0
tz: 2017c

Hexo Configuration

Theoretically independent of Hexo configuration

NexT Information

NexT Version:

  • Latest Master branch
  • Latest Release version
  • Old version

NexT Scheme:

  • All schemes
  • Muse
  • Mist
  • Pisces
  • Gemini

NexT Configuration:

I only modified sensitive information!

Other Information

@siaimes siaimes added the Bug label Apr 29, 2019
@stevenjoezhang
Copy link
Contributor

看上去不是NexT的bug

@siaimes
Copy link
Author

siaimes commented Apr 30, 2019

@stevenjoezhang 我只是提出问题,内部什么情况就不知道啦,你们可以分析一下!

@siaimes
Copy link
Author

siaimes commented May 5, 2019

@ivan-nginx It’s English now.

@stevenjoezhang
Copy link
Contributor

stevenjoezhang commented May 27, 2019

@siaimes 能否换Hexo的默认主题,测试一下这个bug是否依然存在?

@siaimes
Copy link
Author

siaimes commented May 27, 2019

@stevenjoezhang 试了一下,全新的Hexo文件夹也会存在这个问题,那我去Hexo反馈一下这个bug吧,谢谢啦!

@stevenjoezhang
Copy link
Contributor

stevenjoezhang commented May 27, 2019

或者您试试把hexo-renderer-pandoc换成别的:

npm uninstall hexo-renderer-pandoc --save
npm install hexo-renderer-marked --save

@siaimes
Copy link
Author

siaimes commented May 27, 2019

@stevenjoezhang 全新的下载的hexo文件夹也受到我安装的包的影响吗?

@stevenjoezhang
Copy link
Contributor

嗷,那就是Hexo的锅了……

@curbengh
Copy link

curbengh commented Jul 12, 2019

[2] caption is added by the theme through this line,

$imageWrapLink.append('<p class="image-caption">' + imageTitle + '</p>');

If you remove the above line, [2] will not be displayed as a caption if (3.jpg) is valid. But without that line, fancybox may break.

@stevenjoezhang
Copy link
Contributor

这个只在fancybox: true时启用

@curbengh
Copy link

这个只在fancybox: true时启用

Indeed,

CONFIG.fancybox && NexT.utils.wrapImageWithFancyBox();

@siaimes
can you attach your theme's _config.yml? is fancybox enabled?
I tried ![2](3.jpg) while fancybox is disabled and I don't see [2] when (3.jpg) is a valid link.

@curbengh
Copy link

@siaimes 能否换Hexo的默认主题,测试一下这个bug是否依然存在?

@stevenjoezhang 试了一下,全新的Hexo文件夹也会存在这个问题,那我去Hexo反馈一下这个bug吧,谢谢啦!

do you mean hexo-theme-landscape?
Note hexo-theme-landscape will add [2] caption even when fancybox is disabled.
If you remove this line in hexo-theme-landscape, the [2] caption will not be displayed (if 3.jpg exists). So, it's related to theme, not hexo itself.

@siaimes
Copy link
Author

siaimes commented Jul 12, 2019

@siaimes 能否换Hexo的默认主题,测试一下这个bug是否依然存在?

@stevenjoezhang 试了一下,全新的Hexo文件夹也会存在这个问题,那我去Hexo反馈一下这个bug吧,谢谢啦!

do you mean hexo-theme-landscape?
Note hexo-theme-landscape will add [2] caption even when fancybox is disabled.
If you remove this line in hexo-theme-landscape, the [2] caption will not be displayed (if 3.jpg exists). So, it's related to theme, not hexo itself.

In short, theme-next said that it is a problem with hexo. Hexo said that it is a problem caused by the theme. Anyway, I just raised a potential problem, and the rest is left to you. I can only try to avoid such usage.

@stevenjoezhang
Copy link
Contributor

If the issue is caused by fancybox, it should be independent of the code block...
Need to do more test

@curbengh
Copy link

curbengh commented Jul 15, 2019

Anyway, I just raised a potential problem, and the rest is left to you. I can only try to avoid such usage.

I'm trying to troubleshoot the issue with you. The thing is I can't reproduce the bug, so I need more information from you. I requested more information in my previous comment,

So, can you please attach your theme's _config.yml?

If you can attach your post's md file (through pastebin.com), or even better, upload the whole blog to github (including the theme), it would help me tremendously to debug the issue.

I also suggested a workaround for you in my previous comments, by removing this line from hexo-theme-landscape; or if you're using hexo-theme-next then remove these lines, and check whether the issue still persists.

@jiangtj
Copy link
Member

jiangtj commented Jul 15, 2019

image
No markdown renderer. Try run this in bash.

npm install --save hexo-renderer-marked

@siaimes
Copy link
Author

siaimes commented Jul 15, 2019

image
No markdown renderer. Try run this in bash.

npm install --save hexo-renderer-marked

Thank you for your reply, but it doesn't seem to work.

@siaimes
Copy link
Author

siaimes commented Jul 15, 2019

Anyway, I just raised a potential problem, and the rest is left to you. I can only try to avoid such usage.

I'm trying to troubleshoot the issue with you. The thing is I can't reproduce the bug, so I need more information from you. I requested more information in my previous comment,

So, can you please attach your theme's _config.yml?

If you can attach your post's md file (through pastebin.com), or even better, upload the whole blog to github (including the theme), it would help me tremendously to debug the issue.

I also suggested a workaround for you in my previous comments, by removing this line from hexo-theme-landscape; or if you're using hexo-theme-next then remove these lines, and check whether the issue still persists.

The info that I requested so far from you is not on a whim, but to try to pinpoint the source of the issue and to confirm it. So far, I received no additional information/confirmation that is helpful to the cause.

Thank you for your attention to my question. I have uploaded my entire blog to my homepage. I hope that I have deleted all the privacy information, I will delete this project after 24 hours.

project

test page

@stevenjoezhang stevenjoezhang changed the title 代码块+图片块解析错误! 图片块解析错误! Jul 16, 2019
@stevenjoezhang
Copy link
Contributor

The bug is caused by hexo-renderer-pandoc and has nothing to do with theme NexT.
Try:

npm uninstall hexo-renderer-pandoc --save
npm install hexo-renderer-marked --save

@curbengh
Copy link

Anyone having similar issue, please refer to this workaround.

@stevenjoezhang
Copy link
Contributor

Maybe we need to prompt hexo-renderer-pandoc users about this issue in the documentation.

@curbengh
Copy link

I just had a quick test with hexo-renderer-pandoc, figure it might be useful for the doc.
Assuming fancybox is disabled, if an image is preceded or followed by any characters or has a backslash at the end, caption would not be shown. Caption is only shown when the image has new line before and after.

aaa
![alt text](https://postimgs.org/img/logo.png)

![alt text](https://postimgs.org/img/logo.png)
bbb

![alt text](https://postimgs.org/img/logo.png)\

![alt text](https://postimgs.org/img/logo.png)

pandoc

@stevenjoezhang
Copy link
Contributor

pandoc:
  extensions:
    - '-implicit_figures'

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

No branches or pull requests

5 participants