【配置】Typora 图像配置

文章目录
概述

Typora 个人配置,仅供记录,无实质内容

[toc]

图像配置

图片保存路径:

1
./${filename}/

rename-file 插件上传配置

1
{localFolder:3}/{origin}

图源:

1
https://source.unsplash.com/1280x640/?Technology

Typora 插件

插件 typora_plugin:

obgnail/typora_plugin: Typora plugin. Feature enhancement tool | Typora 插件,功能增强工具

自定义斜杠命令

主要修改 setting.user.toml

新增文件内容

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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
[test]
ENABLE = false

[auto_number]
ENABLE_FENCE = false

############### slash_commands ###############
[slash_commands]
# 启用插件
ENABLE = true
# 插件名称
NAME = "斜杠命令"
# 什么样的用户输入触发显示命令列表(若您不了解正则表达式,请勿修改此配置)
# 注意:keyword需要使用命名捕获组kw
# 默认值:匹配一个字符串,该字符串以/或\或、开头,后面紧跟任意数量的非/或\或、字符,且该字符串前面不可有<
TRIGGER_REGEXP = "(?<!<)[\\/、\\\\](?<kw>[^\\/、\\\\]*)$"
# 匹配策略:
# - prefix: 前缀。即:用户输入的字符串必须是keyword的前缀。比如:用户输入para即可找到paragraph
# - substr: 子串。即:用户输入的字符串必须是keyword的子串。比如:用户输入graph即可找到paragraph
# - abbr: 缩写。即:用户输入的每个字符必须都存在于keyword中,并且其在keyword的索引递增。比如:用户输入pgh即可找到paragraph
MATCH_STRATEGY = "abbr"
# 命令列表
# - enable: 是否启用
# - type: snippet/command/gen-snp(snippet: 在调用时插入文字片段;command: 在调用时执行逻辑命令;gen-snp: 在调用时执行函数,返回待插入的文字片段,适用于插入动态内容)
# - scope: 当光标处在哪个位置可用。可选:plain/inline_math(默认为plain)
# - icon(可选): 使用emoji作为图标
# - hint(可选): 提示信息
# - keyword: 关键词,必须唯一
# - callback: 若type=snippet,则填入需要插入的文字片段;若type=command,则填入回调函数;若type=gen-snp,则填入返回字符串的函数
COMMANDS = [
{ enable = true, type = "command", icon = "📝", hint = "一级标题", keyword = "H1", callback = "() => File.editor.stylize.changeBlock('header1', undefined, true)" },
{ enable = true, type = "command", icon = "📝", hint = "二级标题", keyword = "H2", callback = "() => File.editor.stylize.changeBlock('header2', undefined, true)" },
{ enable = true, type = "command", icon = "📝", hint = "三级标题", keyword = "H3", callback = "() => File.editor.stylize.changeBlock('header3', undefined, true)" },
{ enable = true, type = "command", icon = "📝", hint = "四级标题", keyword = "H4", callback = "() => File.editor.stylize.changeBlock('header4', undefined, true)" },
{ enable = true, type = "command", icon = "📝", hint = "五级标题", keyword = "H5", callback = "() => File.editor.stylize.changeBlock('header5', undefined, true)" },
{ enable = true, type = "command", icon = "📝", hint = "六级标题", keyword = "H6", callback = "() => File.editor.stylize.changeBlock('header6', undefined, true)" },
{ enable = true, type = "command", icon = "📝", hint = "段落", keyword = "Paragraph", callback = "() => File.editor.stylize.changeBlock('paragraph')" },
{ enable = true, type = "command", icon = "📝", hint = "提升标题等级", keyword = "IncreaseHeaderLevel", callback = "() => File.editor.stylize.increaseHeaderLevel()" },
{ enable = true, type = "command", icon = "📝", hint = "降低标题等级", keyword = "DecreaseHeaderLevel", callback = "() => File.editor.stylize.decreaseHeaderLevel()" },
{ enable = true, type = "command", icon = "📝", hint = "表格", keyword = "Table", callback = "() => File.editor.tableEdit.insertTable()" },
{ enable = true, type = "command", icon = "📝", hint = "公式块", keyword = "BlockMath", callback = "() => File.editor.stylize.toggleMathBlock()" },
{ enable = true, type = "command", icon = "📝", hint = "代码块", keyword = "BlockCode", callback = "() => File.editor.stylize.toggleFences()" },
{ enable = true, type = "command", icon = "📝", hint = "引用", keyword = "Blockquote", callback = "() => File.editor.stylize.toggleIndent('blockquote')" },
{ enable = true, type = "command", icon = "📝", hint = "有序列表", keyword = "OrderedList", callback = "() => File.editor.stylize.toggleIndent('ol')" },
{ enable = true, type = "command", icon = "📝", hint = "无序列表", keyword = "UnorderedList", callback = "() => File.editor.stylize.toggleIndent('ul')" },
{ enable = true, type = "command", icon = "📝", hint = "任务列表", keyword = "Tasklist", callback = "() => File.editor.stylize.toggleIndent('tasklist')" },
{ enable = true, type = "command", icon = "📝", hint = "增加列表缩进", keyword = "ListMoreIndent", callback = "() => File.editor.UserOp.moreIndent(File.editor)" },
{ enable = true, type = "command", icon = "📝", hint = "减少列表缩进", keyword = "ListLessIndent", callback = "() => File.editor.UserOp.lessIndent(File.editor)" },
{ enable = true, type = "command", icon = "📝", hint = "在上方插入段落", keyword = "InsertParagraphAbove", callback = "() => File.editor.UserOp.insertParagraph(true)" },
{ enable = true, type = "command", icon = "📝", hint = "在下方插入段落", keyword = "InsertParagraphBelow", callback = "() => File.editor.UserOp.insertParagraph(false)" },
{ enable = true, type = "command", icon = "📝", hint = "链接引用", keyword = "DefLink", callback = "() => File.editor.stylize.insertBlock('def_link')" },
{ enable = true, type = "command", icon = "📝", hint = "脚注", keyword = "DefFootnote", callback = "() => File.editor.stylize.insertBlock('def_footnote')" },
{ enable = true, type = "command", icon = "📝", hint = "水平分割线", keyword = "Hr", callback = "() => File.editor.stylize.insertBlock('hr')" },
{ enable = true, type = "command", icon = "📝", hint = "内容目录", keyword = "Toc", callback = "() => File.editor.stylize.insertBlock('toc')" },
{ enable = true, type = "command", icon = "📝", hint = "元信息", keyword = "FrontMatter", callback = "() => File.editor.stylize.insertMetaBlock()" },
{ enable = true, type = "command", icon = "👕", hint = "粗体", keyword = "Strong", callback = "() => File.editor.stylize.toggleStyle('strong')" },
{ enable = true, type = "command", icon = "👕", hint = "斜体", keyword = "Em", callback = "() => File.editor.stylize.toggleStyle('em')" },
{ enable = true, type = "command", icon = "👕", hint = "下划线", keyword = "Underline", callback = "() => File.editor.stylize.toggleStyle('underline')" },
{ enable = true, type = "command", icon = "👕", hint = "代码", keyword = "Code", callback = "() => File.editor.stylize.toggleStyle('code')" },
{ enable = true, type = "command", icon = "👕", hint = "内联公式", keyword = "InlineMath", callback = "() => File.editor.stylize.toggleStyle('inline_math')" },
{ enable = true, type = "command", icon = "👕", hint = "删除线", keyword = "Delete", callback = "() =>File.editor.stylize.toggleStyle('del')" },
{ enable = true, type = "command", icon = "👕", hint = "注释", keyword = "Comment", callback = "() => File.editor.stylize.toggleStyle('comment')" },
{ enable = true, type = "command", icon = "👕", hint = "超链接", keyword = "Link", callback = "() => File.editor.stylize.toggleStyle('link')" },
{ enable = true, type = "command", icon = "👕", hint = "图像", keyword = "Image", callback = "() => File.editor.stylize.toggleStyle('image')" },
{ enable = true, type = "command", icon = "👕", hint = "清除样式", keyword = "ClearStyle", callback = "() => File.editor.stylize.clearStyle()" },
{ enable = true, type = "command", icon = "🧰", hint = "至顶部", keyword = "JumpTop", callback = "() => File.editor.selection.jumpTop()" },
{ enable = true, type = "command", icon = "🧰", hint = "至底部", keyword = "JumpBottom", callback = "() => File.editor.selection.jumpBottom()" },
{ enable = true, type = "command", icon = "🧰", hint = "至行首", keyword = "JumpToLineStart", callback = "() => File.editor.selection.jumpToLineStart()" },
{ enable = true, type = "command", icon = "🧰", hint = "至行尾", keyword = "JumpToLineEnd", callback = "() => File.editor.selection.jumpToLineEnd()" },
{ enable = true, type = "command", icon = "🧰", hint = "帮助", keyword = "Help", callback = "() => this.call()" },
{ enable = true, type = "gen-snp", icon = "🧩", hint = "日期时间", keyword = "Datetime", callback = "() => new Date().toLocaleString('chinese', {hour12: false})" },
{ enable = true, type = "gen-snp", icon = "🧩", hint = "日期", keyword = "Date", callback = "() => {let day = new Date(); return `${day.getFullYear()}/${day.getMonth() + 1}/${day.getDate()}`}" },
{ enable = true, type = "gen-snp", icon = "🧩", hint = "时间", keyword = "Time", callback = "() => {let day = new Date(); return `${day.getHours()}:${day.getMinutes()}:${day.getSeconds()}`}" },
{ enable = true, type = "gen-snp", icon = "🧩", hint = "时间戳", keyword = "Timestamp", callback = "() => new Date().getTime().toString()" },
{ enable = true, type = "gen-snp", icon = "🧩", hint = "星期", keyword = "Week", callback = "() => '星期' + '日一二三四五六'.charAt((new Date()).getDay())" },
{ enable = true, type = "snippet", icon = "🧩", hint = "示例片段", keyword = "SnippetExample", callback = "https://github.com/obgnail/typora_plugin" },
{ enable = true, type = "snippet", scope = "inline_math", icon = "🧩", keyword = "alpha", callback = "\\alpha " },
{ enable = true, type = "snippet", scope = "inline_math", icon = "🧩", keyword = "beta", callback = "\\beta " },
{ enable = true, type = "snippet", scope = "inline_math", icon = "🧩", keyword = "epsilon", callback = "\\epsilon " },
{ enable = true, type = "snippet", scope = "inline_math", icon = "🧩", keyword = "rightarrow", callback = "\\rightarrow " },
{ enable = true, type = "snippet", icon = "🎨", hint = "绿色下划线动画", keyword = "span1", callback = """<span class="fas faa-ring animated-hover" style="border-bottom:3px solid green"></span>""" },
{ enable = true, type = "snippet", icon = "🎨", hint = "紫色书法文字", keyword = "span2", callback = """<span style="text-align:center;font-size:20px;font:30px 书体坊兰亭体;color:blueviolet;word-spacing:30px;">“ ”</span>""" },
{ enable = true, type = "snippet", icon = "🎨", hint = "弹跳紫色下划线", keyword = "span3", callback = """<span style="class: faa-bounce animated-hover;border-bottom: 5px solid #8F81EF;"></span>""" },
{ enable = true, type = "snippet", icon = "🎨", hint = "宝蓝高亮标记", keyword = "span4", callback = """<mark style="background:royalBlue;border-bottom:lightblue 2px solid;color:white;font-family:consolas"></mark>""" },
{ enable = true, type = "snippet", icon = "🎨", hint = "粉红圆角标签", keyword = "span5", callback = """<span class="concept-tag" style="display: inline-block;background: #C2185B;color: white;padding: 2px 8px;border-radius: 6px;font-weight: bold;font-size: 0.95em;"></span>""" },
{ enable = true, type = "snippet", icon = "🎨", hint = "绿色圆角标记", keyword = "span6", callback = """<mark class="effect-note" style="background: #2E7D32;color: white;padding: 3px 8px;border-radius: 4px;font-weight: 600;font-size: 0.9em;"></mark>""" },
{ enable = true, type = "snippet", icon = "🎨", hint = "彩云字体", keyword = "span7", callback = """<font size=10px style="font-weight:700;font-family:'华文彩云';color:rgb(100,190,100)"></font>""" },
{ enable = true, type = "snippet", icon = "🎨", hint = "黑色虚线边框", keyword = "span8", callback = """<span style="border-bottom: 2px dashed #000000"></span>""" },
{ enable = true, type = "snippet", icon = "🎨", hint = "黑色代码块", keyword = "span9", callback = """<div style="background: #000;color:#0F0;font-family:Consolas, monospace;padding:12px;border-radius:6px;overflow-x:auto;margin:1em 0;">
&nbsp; 1 <br>
&nbsp; 2
</div>""" },
{ enable = true, type = "snippet", icon = "🎨", hint = "红色圆形标记", keyword = "span10", callback = """<mark class="performance-boost" style="display: inline-block;background: #D32F2F;color: white;padding: 2px 8px;border-radius: 20px;font-weight: 600;font-size: 0.95em;"> </mark>""" },
{ enable = true, type = "snippet", icon = "✍️", hint = "文章编辑中", keyword = "todo", callback = """<div style="background-color: #cce5ff; color: #004085; padding: 15px; border-radius: 5px; border: 1px solid #b8daff; margin-bottom: 20px;">
<h3 style="margin-top: 0; color: #004085;"><i class="fas fa-edit"></i>正在编辑中...</h3>
<p>正在努力完善这篇文章的内容。在此期间,部分信息可能会有所缺失或不准确。</p>
<small>预计更新日期:2099 年 12 月 30 日</small>
</div>""" },
{ enable = true, type = "snippet", icon = "🤖", hint = "AI生成说明", keyword = "AIINFO", callback = """<div style="padding:10px 0; margin:20px 0; font-size:0.9em; color:#888; border-top:1px dashed #eee; border-bottom:1px dashed #eee;">
<em>本文部分内容由 AI 生成,经人工修订。</em>
</div>""" },
]

如何使用:

1
2
3
/span1
...
/span10