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

表格类型加密解密后无法正常渲染成表格 #1

Closed
WithdewHua opened this issue Apr 17, 2019 · 8 comments
Closed

表格类型加密解密后无法正常渲染成表格 #1

WithdewHua opened this issue Apr 17, 2019 · 8 comments

Comments

@WithdewHua
Copy link

与表格有关的标签在加密解密后都变成了<p>,导致表格显示不正常。

@oyiadin
Copy link
Collaborator

oyiadin commented Apr 17, 2019

Hi,我本地环境下无法复现,请问能提供更多的信息么?

@WithdewHua
Copy link
Author

你好,
例如这是原 MarkDown 文档:

序号 测试 测试
1 1 1
2 2 2
3 3 3

正常渲染成 HTML 后是:

<table>
<thead>
<tr>
<th align="center">序号</th>
<th align="center">测试</th>
<th align="center">测试</th>
</tr>
</thead>

<tbody>
<tr>
<td align="center">1</td>
<td align="center">1</td>
<td align="center">1</td>
</tr>

<tr>
<td align="center">2</td>
<td align="center">2</td>
<td align="center">2</td>
</tr>

<tr>
<td align="center">3</td>
<td align="center">3</td>
<td align="center">3</td>
</tr>
</tbody>
</table>

加上 hugo-encryptor shortcodes 之后生成的 HTML 文档,如下:

    <p>| 序号 | 测试 | 测试 |
|  |  |  |
|  1   |  1   |  1   |
|  2   |  2   |  2   |
|  3   |  3   |  3   |</p>

hugo version: 0.54.0

@Li4n0
Copy link
Owner

Li4n0 commented Apr 17, 2019

抱歉我们还是未能浮现你的问题...你确定在没有使用 Hugo-Encryptorshortcode 之前 表格 可以被正常渲染吗?如果可以的话,能否提供一下整个markdown文件供我们复现一下?

@WithdewHua
Copy link
Author

完整 MarkDown 内容如下:

---
author: WithdewHua
categories: []
tags: []
series: []
date: "2019-04-17T20:32:11+08:00"
lastmod: 
description: 
featured: 
featuredalt: 
featuredpath: 
linktitle: 
title: test
type: post  
---

这是不加 `shortcodes`的表格:

| 序号 | 测试 | 测试 |
| :--: | :--: | :--: |
|  1   |  1   |  1   |
|  2   |  2   |  2   |
|  3   |  3   |  3   |

 这是加了`shortcodes`的表格:

<!--more-->
{{% hugo-encryptor "test" %}}

| 序号 | 测试 | 测试 |
| :--: | :--: | :--: |
|  1   |  1   |  1   |
|  2   |  2   |  2   |
|  3   |  3   |  3   |

{{% /hugo-encryptor %}}

渲染成 HTML 后的页面:https://5cb71e881407b22fa839b3db--withdewhua.netlify.com/
密码为:test

@oyiadin
Copy link
Collaborator

oyiadin commented Apr 17, 2019

Hi,十分抱歉,你提供的这份文件,在我们两人的机器上都能够正常渲染(Hugo 0.54.0,也是 Linux 系统),怀疑是主题的问题?

虽然依然不知道原因是什么,不过我搜了很久的谷歌,给你提出两个可能的解决方案:

  1. 尝试将 shortcodes 文件的 39 行改为:
    {{ .Inner | markdownify }}
  1. 将 markdown 语法中的两个连字符增加到三个或以上,参考此处

@WithdewHua
Copy link
Author

两种方案都尝试了,但是依然没有解决,可能是主题的原因吧,算了,我直接用 HTML 标签好了,感谢两位的解答。

@WithdewHua
Copy link
Author

找到解决办法了,使用 blackfriday 解析器中的 table 简写写法,即可正常解析。

@oyiadin
Copy link
Collaborator

oyiadin commented Apr 18, 2019

好的,感谢反馈!

@oyiadin oyiadin closed this as completed Apr 18, 2019
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

3 participants