💡 参考文章见Ref,感谢提供思路!
🗺️当前这篇博文地址:https://myoontyee.github.io/article/f5721cb9.html
⚠️警告:博客文章禁止一切形式的非授权非法转载!
⚠️Attention: All forms of unauthorized illegal reposts are prohibited !

创建时间:2022年3月19日12:10:56
最新更新:2022年3月20日17:32:35


核心思路


方法特点

  • 法1属于便捷方法,Obsidian、Typora与Hexo都可以顺利显示代码块,但无法显示代码行号
  • 法2在Hexo可以顺利显示代码块与行号,在Obsidian、Typora内需去除所有空行回车才能显示代码块,但无法显示代码行号
  • 法3在Hexo未测试过,在Obsidian内可以显示代码块与行号

法1

生成表格

  • tablesgenerator在线网站按照要求绘制表格,如下图,勾选Line breaks as <br>
    • 表头居中用HTML<center>样式,如<div align = center>修改前</center>
    • 代码写法,表格内显示代码用HTML<pre><code>样式,如<pre><code>coding here</code></pre>
  • 填写完成后点Preview预览一下表格效果,符合要求点Copy to clipboard,并粘贴到Obsidian

最终样式

修改前
修改后

import pandas as pd
pd.read_csv(’.’)


aaa
bbb

法2

生成表格

  • HTML 表格 转换为 HTML 表格按照要求绘制表格,如下图
    • 表头写法,为了居中,使用<div>语法,如<div align = center>修改前</center>
    • 代码写法,直接使用三个点+代码类型,如下
    • 取消勾选转移HTML表格
1
coding here
  • 填写完成点复制到剪切版,粘贴到对应位置即可

最终样式

修改前
修改后
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"cStandard": "c17",
"cppStandard": "c++17",
"intelliSenseMode": "windows-msvc-x64"
}
],
"version": 4
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
{
"configurations": [
{
"name": "Win32",
"browse": {
"path": [
"${workspaceFolder}/src", // 链接source
"${workspaceFolder}/include", // 链接include
"/mnt/d/Geant4/main/geant4.10.07.p02/install/include/Geant4" // 链接Geant4头文件
],
"limitSymbolsToIncludedHeaders": true
},
"includePath": [
"${workspaceFolder}/src", // 链接source
"${workspaceFolder}/include", // 链接include
"/mnt/d/Geant4/main/geant4.10.07.p02/install/include/Geant4" // 链接Geant4头文件
],
// "defines": [
// "_DEBUG",
// "UNICODE",
// "_UNICODE"
// ],
"defines": [
],
"cStandard": "c17",
"cppStandard": "c++17",
// "intelliSenseMode": "windows-msvc-x64"
"intelliSenseMode": "clang-x64"
}
],
"version": 4
}
  • Typora内效果如下图

法3

生成表格

  • HTML 表格 转换为 HTML 表格按照要求绘制表格,如下图
    • 表头写法,为了居中,使用<div>语法,如<div align = center>修改前</center>
    • 代码写法,表格内显示代码用HTML<pre><code>样式,如<pre><code>coding here</code></pre>
    • 取消勾选转移HTML表格
  • 填写完成点复制到剪切版,粘贴到对应位置即可

最终样式

修改前
修改后

{
{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "cStandard": "c17",
            "cppStandard": "c++17",
            "intelliSenseMode": "windows-msvc-x64"
        }
    ],
    "version": 4
}
}

{
    "configurations": [
        {
            "name": "Win32",
            "browse": {
                "path": [
                    "${workspaceFolder}/src",                                       // 链接source
                    "${workspaceFolder}/include",                                   // 链接include
                    "/mnt/d/Geant4/main/geant4.10.07.p02/install/include/Geant4"    // 链接Geant4头文件
                ],
                "limitSymbolsToIncludedHeaders": true
            },
            "includePath": [
                "${workspaceFolder}/src",                                       // 链接source
                "${workspaceFolder}/include",                                   // 链接include
                "/mnt/d/Geant4/main/geant4.10.07.p02/install/include/Geant4"    // 链接Geant4头文件
            ],
            // "defines": [
            //     "_DEBUG",
            //     "UNICODE",
            //     "_UNICODE"
            // ],
            "defines": [
            ],
            "cStandard": "c17",
            "cppStandard": "c++17",
            // "intelliSenseMode": "windows-msvc-x64"
            "intelliSenseMode": "clang-x64"
        }
    ],
    "version": 4
}
	
  • Typora内样式如下图

Ref