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

似乎hexo对表格支持不好。 #1388

Closed
sharkrice opened this issue Jul 14, 2015 · 18 comments
Closed

似乎hexo对表格支持不好。 #1388

sharkrice opened this issue Jul 14, 2015 · 18 comments
Labels
bug Something isn't working

Comments

@sharkrice
Copy link

渲染前:

表格显示测试:

`

width 设置layout viewport  的宽度,为一个正整数,或字符串"width-device"
initial-scale 设置页面的初始缩放值,为一个数字,可以带小数
minimum-scale 允许用户的最小缩放值,为一个数字,可以带小数
maximum-scale 允许用户的最大缩放值,为一个数字,可以带小数
height 设置layout viewport  的高度,这个属性对我们并不重要,很少使用
user-scalable 是否允许用户进行缩放,值为"no"或"yes", no 代表不允许,yes代表允许
` # 渲染后:
<div class="article-entry" itemprop="articleBody">
<p>表格显示测试:</p>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<table border="1" cellpadding="1" cellspacing="0">
    <tbody>
        <tr>
            <td>width</td>
            <td>设置<em><strong>layout viewport</strong></em>&nbsp; 的宽度,为一个正整数,或字符串”width-device”</td>
        </tr>
        <tr>
            <td>initial-scale</td>
            <td>设置页面的初始缩放值,为一个数字,可以带小数</td>
        </tr>
        <tr>
            <td>minimum-scale</td>
            <td>允许用户的最小缩放值,为一个数字,可以带小数</td>
        </tr>
        <tr>
            <td>maximum-scale</td>
            <td>允许用户的最大缩放值,为一个数字,可以带小数</td>
        </tr>
        <tr>
            <td>height</td>
            <td>设置<em><strong>layout viewport</strong></em>&nbsp; 的高度,这个属性对我们并不重要,很少使用</td>
        </tr>
        <tr>
            <td>user-scalable</td>
            <td>是否允许用户进行缩放,值为”no”或”yes”, no 代表不允许,yes代表允许</td>
        </tr>
    </tbody>
</table>

</div>

这么多个
渲染出来有一大段空白,太难看了。

你可以看这个[http://sharkrice.github.io/2015/07/14/hello-world/]

@Xuanwo
Copy link
Contributor

Xuanwo commented Jul 14, 2015

参数 描述
width 设置layout viewport 的宽度,为一个正整数,或字符串"width-device"
initial-scale 设置页面的初始缩放值,为一个数字,可以带小数
minimum-scale 允许用户的最小缩放值,为一个数字,可以带小数
maximum-scale 允许用户的最大缩放值,为一个数字,可以带小数
height 设置layout viewport 的高度,这个属性对我们并不重要,很少使用
user-scalable 是否允许用户进行缩放,值为"no"或"yes", no 代表不允许,yes代表允许

建议还是用Markdown的语法,目前Hexo会渲染出很多<br>,作者正在解决中。
上面的表格源代码是:

参数|描述
---|---|---
width|  设置layout viewport  的宽度,为一个正整数,或字符串"width-device"
initial-scale|  设置页面的初始缩放值,为一个数字,可以带小数
minimum-scale|  允许用户的最小缩放值,为一个数字,可以带小数
maximum-scale|  允许用户的最大缩放值,为一个数字,可以带小数
height| 设置layout viewport  的高度,这个属性对我们并不重要,很少使用
user-scalable|  是否允许用户进行缩放,值为"no"或"yes", no 代表不允许,yes代表允许

@cikichen
Copy link

原来是hexo的bug,我从wp迁移过来后发现我的文章凡是有表格的都有一大段空白,还以为是我的md的问题,目前是否有解决方案呢?

@Xuanwo
Copy link
Contributor

Xuanwo commented Jul 29, 2015

修复中

@Alsiso
Copy link

Alsiso commented Aug 30, 2015

此问题已经修复了吗? 为什么问题被关闭了?

@Xuanwo
Copy link
Contributor

Xuanwo commented Aug 30, 2015

@Alsiso Sorry,操作失误

不过Markdown原生的标记语言无法满足您的需求么?

@ghost
Copy link

ghost commented Oct 9, 2015

这说来说去也没说清楚,hexo支持表格的bug究竟修复了没有

@telnetning
Copy link

3.1.1,没有修复

@Xuanwo
Copy link
Contributor

Xuanwo commented Jan 14, 2016

@sharkrice , 我使用你给出的例子在完全新建的Hexo目录中测试,没有发现有多余的空行。

我插入的代码如下:

<table border="1" cellpadding="1" cellspacing="0"> <tbody> <tr> <td>width</td> <td>设置<em><strong>layout viewport</strong></em>&nbsp; 的宽度,为一个正整数,或字符串"width-device"</td> </tr> <tr> <td>initial-scale</td> <td>设置页面的初始缩放值,为一个数字,可以带小数</td> </tr> <tr> <td>minimum-scale</td> <td>允许用户的最小缩放值,为一个数字,可以带小数</td> </tr> <tr> <td>maximum-scale</td> <td>允许用户的最大缩放值,为一个数字,可以带小数</td> </tr> <tr> <td>height</td> <td>设置<em><strong>layout viewport</strong></em>&nbsp; 的高度,这个属性对我们并不重要,很少使用</td> </tr> <tr> <td>user-scalable</td> <td>是否允许用户进行缩放,值为"no"或"yes", no 代表不允许,yes代表允许</td> </tr> </tbody> </table>

image

image

Update:
我在标签之间插入回车之后发现,出现了<br>标签,我的判断是Marked渲染引擎把这个回车当成<br>处理了。

_config.yml中添加如下配置:

marked:
  gfm: true
  breaks: false

关闭gfm对于回车的识别之后,这个问题修复了。
总的来说,这个锅是因为在GFM格式中,换行只需要一次回车,而在传统Markdown中,换行需要两次回车。作为临时性的解决方案,大家可以先关闭breaks功能。

@cikichen@Alsiso@Ming15@telnetning

@likev
Copy link

likev commented Mar 25, 2016

这个问题也困扰我了两天,希望早点修复。
另外,不仅仅是插入多个<br>的问题,本地 hexo-server 渲染会在页面后产生一些乱码,但是 deploy 至 GitHub Page 没有乱码的问题。

@bohanyang
Copy link

因为 table 要加上 table class 所以不能直接用 markdown

@bohanyang
Copy link

解决办法就是压缩成一行

@verymuch
Copy link

请问这个问题还没有解决吗? 压缩成一行可编辑性太差啦

@xu-song
Copy link
Contributor

xu-song commented Mar 3, 2018

+1 这是个很难修复的bug?

@onlyfly34
Copy link

遇到一樣的問題+1

@fja0kl
Copy link

fja0kl commented Oct 13, 2018

Me,too

@YopheeHsin
Copy link

用了 {% raw %} {% endraw %} 包html table

@HarborZeng
Copy link

用了 {% raw %} {% endraw %} 包html table

666,我也在官网看到过这个,但是没想到用在这里,很佩服您

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

16 participants