gaowei-space / markdown-blog

🍭 Markdown-Blog 是一款小而美的Markdown静态博客程序 | Markdown-Blog is incredibly fast, easy to use, and converts Markdown formatted text files into beautifully rendered HTML pages.
https://blog.gaowei.tech
MIT License
432 stars 57 forks source link

为什么我WIN11用二进制版本,不渲染MD文件呢? #27

Closed dianso closed 1 year ago

dianso commented 1 year ago

运行markdown-blog web启动后能列出来md文件名,内容不渲染

dianso commented 1 year ago

[DBUG] 2023/03/04 22:17 Log level set to "debug" [DBUG] 2023/03/04 22:17 Using <cache/logs/access-20230304.log> to log requests [ERRO] 2023/03/04 22:17 favicon: file or directory D:\markdown-blog\favicon.ico not found: %!w(*fs.PathError=&{open D:\markdown-blog\favicon.ico 2}) [DBUG] 2023/03/04 22:17 Application: view engine "HTML" is registered [DBUG] 2023/03/04 22:17 API: 7 registered routes (3 GET, 2 HEAD and 2 ERROR) GET: /static file server (github.com/gaowei-space/markdown-blog/internal/app/app.go:84) • github.com/gaowei-space/markdown-blog/internal/app.RunWeb (github.com/gaowei-space/markdown-blog/internal/app/app.go:60) GET: /static/{file:path} file server (github.com/gaowei-space/markdown-blog/internal/app/app.go:84) • github.com/gaowei-space/markdown-blog/internal/app.RunWeb (github.com/gaowei-space/markdown-blog/internal/app/app.go:60) GET: /{f:path} (github.com/gaowei-space/markdown-blog/internal/app/app.go:85) • github.com/gaowei-space/markdown-blog/internal/app.RunWeb (github.com/gaowei-space/markdown-blog/internal/app/app.go:60) • iris.cache (:1) • github.com/gaowei-space/markdown-blog/internal/app.articleHandler (github.com/gaowei-space/markdown-blog/internal/app/app.go:203)

HEAD: /static (github.com/gaowei-space/markdown-blog/internal/app/app.go:84) • github.com/gaowei-space/markdown-blog/internal/app.RunWeb (github.com/gaowei-space/markdown-blog/internal/app/app.go:60) HEAD: /static/{file:path} (github.com/gaowei-space/markdown-blog/internal/app/app.go:84) • github.com/gaowei-space/markdown-blog/internal/app.RunWeb (github.com/gaowei-space/markdown-blog/internal/app/app.go:60)

404: / (github.com/gaowei-space/markdown-blog/internal/app/app.go:52) • github.com/gaowei-space/markdown-blog/internal/api.NotFound (github.com/gaowei-space/markdown-blog/internal/api/ErrorResponse.go:5) 500: / (github.com/gaowei-space/markdown-blog/internal/app/app.go:53) • github.com/gaowei-space/markdown-blog/internal/api.InternalServerError (github.com/gaowei-space/markdown-blog/internal/api/ErrorResponse.go:9)

dianso commented 1 year ago

部分渲染成功了,部分不成功,表格也没渲染

gaowei-space commented 1 year ago

可以提供无法渲染的mardown内容么?

dianso commented 1 year ago

可以提供无法渲染的mardown内容么?

你好作者,我测试了下,发现表格不渲染,其他的都可以。

还有就是换行问题,md文件里换行了,网页显示都在一行

dianso commented 1 year ago

可以提供无法渲染的mardown内容么?

正常一段话后面加2个空格回车后就可以换行了,不知道我为什么一直没成功

gaowei-space commented 1 year ago

可以提供无法渲染的mardown内容么?

正常一段话后面加2个空格回车后就可以换行了,不知道我为什么一直没成功

这个确实是有兼容问题,我记录下

gaowei-space commented 1 year ago

可以提供无法渲染的mardown内容么?

你好作者,我测试了下,发现表格不渲染,其他的都可以。

还有就是换行问题,md文件里换行了,网页显示都在一行

表格问题,我这边测试是没问题的,而且在我的博客中也有表格的使用。

如果可以的话,贴一下你表格语法看看

dianso commented 1 year ago

可以提供无法渲染的mardown内容么?

你好作者,我测试了下,发现表格不渲染,其他的都可以。 还有就是换行问题,md文件里换行了,网页显示都在一行

表格问题,我这边测试是没问题的,而且在我的博客中也有表格的使用。

如果可以的话,贴一下你表格语法看看

比如这个

啊啊
1111111 11111111111
dianso commented 1 year ago

竖线111竖线111竖线 竖线:------:竖线:------:竖线

就是标准语法

gaowei-space commented 1 year ago

竖线111竖线111竖线 竖线:------:竖线:------:竖线

就是标准语法

试试这样的语法 @dianso

Style | Preveiw
--------|------
Dark | test1
Light | test2

展示结果如下:

Style Preveiw
Dark test1
Light test2
dianso commented 1 year ago

竖线111竖线111竖线 竖线:------:竖线:------:竖线 就是标准语法

试试这样的语法 @dianso

Style | Preveiw
--------|------
Dark | test1
Light | test2

展示结果如下:

Style Preveiw Dark test1 Light test2

也不行

gaowei-space commented 1 year ago

竖线111竖线111竖线 竖线:------:竖线:------:竖线 就是标准语法

试试这样的语法 @dianso

Style | Preveiw
--------|------
Dark | test1
Light | test2

展示结果如下: Style Preveiw Dark test1 Light test2

也不行

那就奇怪了啊,我们的都没问题,不过我没测试过win的程序,理论上都是用的一套md解析语法应可以的啊

dianso commented 1 year ago

竖线111竖线111竖线 竖线:------:竖线:------:竖线 就是标准语法

试试这样的语法 @dianso

Style | Preveiw
--------|------
Dark | test1
Light | test2

展示结果如下: Style Preveiw Dark test1 Light test2

也不行

那就奇怪了啊,我们的都没问题,不过我没测试过win的程序,理论上都是用的一套md解析语法应可以的啊

我估计是换行问题,看源代码

Style|Preveiw --------|------ 123|123

并没有解析

dianso commented 1 year ago

竖线111竖线111竖线 竖线:------:竖线:------:竖线 就是标准语法

试试这样的语法 @dianso

Style | Preveiw
--------|------
Dark | test1
Light | test2

展示结果如下: Style Preveiw Dark test1 Light test2

也不行

那就奇怪了啊,我们的都没问题,不过我没测试过win的程序,理论上都是用的一套md解析语法应可以的啊

找到原因了,是换行符号问题,看了下你的代码,用的库不支持标准MD换行语法,就是行末增加2个空格然后回车。

而是直接按回车就能换行,但是换行符只支持unix(lf),不支持windows(crlf)的。

我用了unix换行后,WIN11和NAS里面的docker版本都能完美换行,表格也能解析了。

我平时多在win11平台,所以只能用notepadnext这类编辑器强行把换行符转换成unix形式的,如果解析器能自动将windows的转换成unix的就好了。

gaowei-space commented 1 year ago

竖线111竖线111竖线 竖线:------:竖线:------:竖线 就是标准语法

试试这样的语法 @dianso

Style | Preveiw
--------|------
Dark | test1
Light | test2

展示结果如下: Style Preveiw Dark test1 Light test2

也不行

那就奇怪了啊,我们的都没问题,不过我没测试过win的程序,理论上都是用的一套md解析语法应可以的啊

找到原因了,是换行符号问题,看了下你的代码,用的库不支持标准MD换行语法,就是行末增加2个空格然后回车。

而是直接按回车就能换行,但是换行符只支持unix(lf),不支持windows(crlf)的。

我用了unix换行后,WIN11和NAS里面的docker版本都能完美换行,表格也能解析了。

我平时多在win11平台,所以只能用notepadnext这类编辑器强行把换行符转换成unix形式的,如果解析器能自动将windows的转换成unix的就好了。

厉害啊👍

我也会跟进下三方扩展的更新,看看会不会支持~

dianso commented 1 year ago

竖线111竖线111竖线 竖线:------:竖线:------:竖线 就是标准语法

试试这样的语法 @dianso

Style | Preveiw
--------|------
Dark | test1
Light | test2

展示结果如下: Style Preveiw Dark test1 Light test2

也不行

那就奇怪了啊,我们的都没问题,不过我没测试过win的程序,理论上都是用的一套md解析语法应可以的啊

找到原因了,是换行符号问题,看了下你的代码,用的库不支持标准MD换行语法,就是行末增加2个空格然后回车。 而是直接按回车就能换行,但是换行符只支持unix(lf),不支持windows(crlf)的。 我用了unix换行后,WIN11和NAS里面的docker版本都能完美换行,表格也能解析了。 我平时多在win11平台,所以只能用notepadnext这类编辑器强行把换行符转换成unix形式的,如果解析器能自动将windows的转换成unix的就好了。

厉害啊👍

我也会跟进下三方扩展的更新,看看会不会支持~

https://github.com/russross/blackfriday/pull/428

好几年前就有人说过这个问题,也有修复方案,不过没有得到重视。

https://github.com/russross/blackfriday/issues/423

这里有个方法,就是:

带有 Windows 行尾 (CLRF) 的文本。我目前的解决方法是在将它们传递给 blackfriday 之前替换它们:

markdownWithUnixLineEndings := strings.Replace(markdown, "\r\n", "\n", -1) blackfriday.Run([]byte(markdownWithUnixLineEndings))

https://github.com/gwd/session-scheduler/commit/904bb13cd879acf041da18dafaaff4acecbdb3d2

https://github.com/go-gitea/gitea/blob/dc8036dcc680abab52b342d18181a5ee42f40318/modules/util/util.go#L68-L102

按照这个修改下也行。

Vanisper commented 1 year ago

竖线111竖线111竖线 竖线:------:竖线:------:竖线 就是标准语法

试试这样的语法 @dianso

Style | Preveiw
--------|------
Dark | test1
Light | test2

展示结果如下: Style Preveiw Dark test1 Light test2

也不行

那就奇怪了啊,我们的都没问题,不过我没测试过win的程序,理论上都是用的一套md解析语法应可以的啊

找到原因了,是换行符号问题,看了下你的代码,用的库不支持标准MD换行语法,就是行末增加2个空格然后回车。 而是直接按回车就能换行,但是换行符只支持unix(lf),不支持windows(crlf)的。 我用了unix换行后,WIN11和NAS里面的docker版本都能完美换行,表格也能解析了。 我平时多在win11平台,所以只能用notepadnext这类编辑器强行把换行符转换成unix形式的,如果解析器能自动将windows的转换成unix的就好了。

厉害啊👍

我也会跟进下三方扩展的更新,看看会不会支持~

大佬! 关于这个问题我晚上给您发了两个邮件 请你查收一下 就是您GitHub主页上的那个邮箱 我提了一个修复方案,我现在才看到这里原来有issues 请你看一下邮箱

gaowei-space commented 1 year ago

竖线111竖线111竖线 竖线:------:竖线:------:竖线 就是标准语法

试试这样的语法 @dianso

Style | Preveiw
--------|------
Dark | test1
Light | test2

展示结果如下: Style Preveiw Dark test1 Light test2

也不行

那就奇怪了啊,我们的都没问题,不过我没测试过win的程序,理论上都是用的一套md解析语法应可以的啊

找到原因了,是换行符号问题,看了下你的代码,用的库不支持标准MD换行语法,就是行末增加2个空格然后回车。 而是直接按回车就能换行,但是换行符只支持unix(lf),不支持windows(crlf)的。 我用了unix换行后,WIN11和NAS里面的docker版本都能完美换行,表格也能解析了。 我平时多在win11平台,所以只能用notepadnext这类编辑器强行把换行符转换成unix形式的,如果解析器能自动将windows的转换成unix的就好了。

厉害啊👍 我也会跟进下三方扩展的更新,看看会不会支持~

大佬! 关于这个问题我晚上给您发了两个邮件 请你查收一下 就是您GitHub主页上的那个邮箱 我提了一个修复方案,我现在才看到这里原来有issues 请你看一下邮箱

好的