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

代码段中包含 URL 时,通常不需要被转换为链接 #47

Closed
deepjia opened this issue Jan 4, 2018 · 4 comments
Closed

代码段中包含 URL 时,通常不需要被转换为链接 #47

deepjia opened this issue Jan 4, 2018 · 4 comments
Assignees

Comments

@deepjia
Copy link

deepjia commented Jan 4, 2018

当代码段的内容中有 URL 时,通常不需要被转换为链接,例如如下的 bash 代码段:

wget https://github.com/laozhu/hugo-nuo/archive/master.zip

而在 hugo-nuo 模版中,它会被转换成可点击的链接。

不确定是否该模版的一个 Feature,但私以为是个 BUG。

@laozhu
Copy link
Owner

laozhu commented Jan 4, 2018

我自己 Markdown 里面试了下,我是这么写的:

```bash
wget https://github.com/laozhu/hugo-nuo/archive/master.zip
```

并没有出现链接,如下:

kapture 2018-01-04 at 18 53 44

@deepjia
Copy link
Author

deepjia commented Jan 4, 2018

刚才又尝试了几次,找到了重现的规律。

首先生成的 HTML 源码中没有被转换为链接,我在本地 hugo server 调试时,直接用 ip 或者 localhost 访问(如 http://localhost:1313/post/sth/ )的时候,也没有这个问题;

但是一但通过域名访问(包括解析到本地的域名,例如 http://127.0.0.1.xip.io:1313/post/sth/ ),网页加载完毕以后,就会自动转换成链接。

不知道是模版或者 Hugo 本身的问题,还是是 Hugo 的特性。

@laozhu
Copy link
Owner

laozhu commented Jan 5, 2018

我还真没遇到这种情况,或者你可以把复现的步骤写详细些,我跟着步骤复现一下。

@deepjia
Copy link
Author

deepjia commented Jan 5, 2018

部署到服务器/静态空间以后,通过域名访问就会遇到了;
也可以在本地重现,步骤如上一条评论:
运行 hugo server 以后用域名打开本地文章页面(用上述提到的域名 127.0.0.1.xip.io 即可,该域名是解析到 127.0.0.1 的),等页面加载完毕后,页面中此类 URL 就会突然变成链接。
————————————
我刚才留意到,你的博客里没有出现这种问题,所以我想可能是 hugo 0.32.2 的问题。

@deepjia deepjia closed this as completed Jan 14, 2018
@laozhu laozhu self-assigned this Jan 28, 2018
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

2 participants