mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 07:00:12 +01:00
🎨 Supports disabling Markdown syntax input for some inline elements https://github.com/siyuan-note/siyuan/issues/11141
This commit is contained in:
parent
53f5b08038
commit
b9f269ae85
17 changed files with 185 additions and 41 deletions
|
|
@ -1,4 +1,12 @@
|
||||||
{
|
{
|
||||||
|
"editorMarkdownInlineSup": "Markdown inline superscript syntax",
|
||||||
|
"editorMarkdownInlineSupTip": "After enabling, <code class='fn__code'>^foo^</code> inline superscript input will be supported",
|
||||||
|
"editorMarkdownInlineSub": "Markdown inline subscript syntax",
|
||||||
|
"editorMarkdownInlineSubTip": "After enabling, <code class='fn__code'>~foo~</code> inline subscript input will be supported",
|
||||||
|
"editorMarkdownInlineTag": "Markdown inline tag syntax",
|
||||||
|
"editorMarkdownInlineTagTip": "After enabling, <code class='fn__code'>#foo#</code> inline tag input will be supported",
|
||||||
|
"editorMarkdownInlineMath": "Markdown inline formula syntax",
|
||||||
|
"editorMarkdownInlineMathTip": "After enabling, <code class='fn__code'>$foo$</code> inline formula input will be supported",
|
||||||
"currentNotebook": "Current Notebook",
|
"currentNotebook": "Current Notebook",
|
||||||
"containerBlockTip1": "Enabling container blocks will result in duplicate search results",
|
"containerBlockTip1": "Enabling container blocks will result in duplicate search results",
|
||||||
"containerBlockTip2": "Enabling document blocks currently only supports searching for document titles",
|
"containerBlockTip2": "Enabling document blocks currently only supports searching for document titles",
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,12 @@
|
||||||
{
|
{
|
||||||
|
"editorMarkdownInlineSup": "Sintaxis de superíndice en línea de Markdown",
|
||||||
|
"editorMarkdownInlineSupTip": "Después de habilitar, se admitirá la entrada de superíndice en línea <code class='fn__code'>^foo^</code>",
|
||||||
|
"editorMarkdownInlineSub": "Sintaxis del subíndice en línea de Markdown",
|
||||||
|
"editorMarkdownInlineSubTip": "Después de habilitar, se admitirá la entrada de subíndice en línea <code class='fn__code'>~foo~</code>",
|
||||||
|
"editorMarkdownInlineTag": "Sintaxis de etiquetas en línea de Markdown",
|
||||||
|
"editorMarkdownInlineTagTip": "Después de habilitar, se admitirá la entrada de etiquetas en línea <code class='fn__code'>#foo#</code>",
|
||||||
|
"editorMarkdownInlineMath": "Sintaxis de fórmula en línea de Markdown",
|
||||||
|
"editorMarkdownInlineMathTip": "Después de habilitar, se admitirá la entrada de fórmula en línea <code class='fn__code'>$foo$</code>",
|
||||||
"currentNotebook": "Cuaderno actual",
|
"currentNotebook": "Cuaderno actual",
|
||||||
"containerBlockTip1": "Habilitar bloques de contenedores generará resultados de búsqueda duplicados",
|
"containerBlockTip1": "Habilitar bloques de contenedores generará resultados de búsqueda duplicados",
|
||||||
"containerBlockTip2": "Habilitar bloques de documentos actualmente solo admite la búsqueda de títulos de documentos",
|
"containerBlockTip2": "Habilitar bloques de documentos actualmente solo admite la búsqueda de títulos de documentos",
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,12 @@
|
||||||
{
|
{
|
||||||
|
"editorMarkdownInlineSup": "Syntaxe exposant Markdown en ligne",
|
||||||
|
"editorMarkdownInlineSupTip": "Après l'activation, la saisie en exposant <code class='fn__code'>^foo^</code> en ligne sera prise en charge",
|
||||||
|
"editorMarkdownInlineSub": "Syntaxe d'indice en ligne Markdown",
|
||||||
|
"editorMarkdownInlineSubTip": "Après l'activation, la saisie en indice <code class='fn__code'>~foo~</code> en ligne sera prise en charge",
|
||||||
|
"editorMarkdownInlineTag": "Syntaxe des balises en ligne Markdown",
|
||||||
|
"editorMarkdownInlineTagTip": "Après l'activation, la saisie de balises en ligne <code class='fn__code'>#foo#</code> sera prise en charge",
|
||||||
|
"editorMarkdownInlineMath": "Syntaxe de formule en ligne Markdown",
|
||||||
|
"editorMarkdownInlineMathTip": "Après l'activation, la saisie de formule en ligne <code class='fn__code'>$foo$</code> sera prise en charge",
|
||||||
"currentNotebook": "Carnet actuel",
|
"currentNotebook": "Carnet actuel",
|
||||||
"containerBlockTip1": "L'activation des blocs de conteneurs entraînera des résultats de recherche en double",
|
"containerBlockTip1": "L'activation des blocs de conteneurs entraînera des résultats de recherche en double",
|
||||||
"containerBlockTip2": "L'activation des blocs de documents ne prend actuellement en charge que la recherche de titres de documents",
|
"containerBlockTip2": "L'activation des blocs de documents ne prend actuellement en charge que la recherche de titres de documents",
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,12 @@
|
||||||
{
|
{
|
||||||
|
"editorMarkdownInlineSup": "Markdown 行級上標語法",
|
||||||
|
"editorMarkdownInlineSupTip": "啟用後將支援 <code class='fn__code'>^foo^</code> 行級上標輸入",
|
||||||
|
"editorMarkdownInlineSub": "Markdown 行級下標語法",
|
||||||
|
"editorMarkdownInlineSubTip": "啟用後將支援 <code class='fn__code'>~foo~</code> 行級下標輸入",
|
||||||
|
"editorMarkdownInlineTag": "Markdown 行級標籤語法",
|
||||||
|
"editorMarkdownInlineTagTip": "啟用後將支援 <code class='fn__code'>#foo#</code> 行級標籤輸入",
|
||||||
|
"editorMarkdownInlineMath": "Markdown 行級公式語法",
|
||||||
|
"editorMarkdownInlineMathTip": "啟用後將支援 <code class='fn__code'>$foo$</code> 行級公式輸入",
|
||||||
"currentNotebook": "目前筆記本",
|
"currentNotebook": "目前筆記本",
|
||||||
"containerBlockTip1": "啟用容器區塊後會導致搜尋結果重複",
|
"containerBlockTip1": "啟用容器區塊後會導致搜尋結果重複",
|
||||||
"containerBlockTip2": "啟用文件區塊目前僅支援搜尋文件名稱",
|
"containerBlockTip2": "啟用文件區塊目前僅支援搜尋文件名稱",
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,12 @@
|
||||||
{
|
{
|
||||||
|
"editorMarkdownInlineSup": "Markdown 行级上标语法",
|
||||||
|
"editorMarkdownInlineSupTip": "启用后将支持 <code class='fn__code'>^foo^</code> 上标输入",
|
||||||
|
"editorMarkdownInlineSub": "Markdown 行级下标语法",
|
||||||
|
"editorMarkdownInlineSubTip": "启用后将支持 <code class='fn__code'>~foo~</code> 下标输入",
|
||||||
|
"editorMarkdownInlineTag": "Markdown 行级标签语法",
|
||||||
|
"editorMarkdownInlineTagTip": "启用后将支持 <code class='fn__code'>#foo#</code> 标签输入",
|
||||||
|
"editorMarkdownInlineMath": "Markdown 行级公式语法",
|
||||||
|
"editorMarkdownInlineMathTip": "启用后将支持 <code class='fn__code'>$foo$</code> 行级公式输入",
|
||||||
"currentNotebook": "当前笔记本",
|
"currentNotebook": "当前笔记本",
|
||||||
"containerBlockTip1": "启用容器块后会导致搜索结果重复",
|
"containerBlockTip1": "启用容器块后会导致搜索结果重复",
|
||||||
"containerBlockTip2": "启用文档块目前仅支持搜索文档名",
|
"containerBlockTip2": "启用文档块目前仅支持搜索文档名",
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,38 @@ export const editor = {
|
||||||
<span class="fn__space"></span>
|
<span class="fn__space"></span>
|
||||||
<input class="b3-switch fn__flex-center" id="fullWidth" type="checkbox"${window.siyuan.config.editor.fullWidth ? " checked" : ""}/>
|
<input class="b3-switch fn__flex-center" id="fullWidth" type="checkbox"${window.siyuan.config.editor.fullWidth ? " checked" : ""}/>
|
||||||
</label>
|
</label>
|
||||||
|
<label class="fn__flex b3-label">
|
||||||
|
<div class="fn__flex-1">
|
||||||
|
${window.siyuan.languages.editorMarkdownInlineSup}
|
||||||
|
<div class="b3-label__text">${window.siyuan.languages.editorMarkdownInlineSupTip}</div>
|
||||||
|
</div>
|
||||||
|
<span class="fn__space"></span>
|
||||||
|
<input class="b3-switch fn__flex-center" id="editorMarkdownInlineSup" type="checkbox"${window.siyuan.config.editor.markdown.inlineSup ? " checked" : ""}/>
|
||||||
|
</label>
|
||||||
|
<label class="fn__flex b3-label">
|
||||||
|
<div class="fn__flex-1">
|
||||||
|
${window.siyuan.languages.editorMarkdownInlineSub}
|
||||||
|
<div class="b3-label__text">${window.siyuan.languages.editorMarkdownInlineSubTip}</div>
|
||||||
|
</div>
|
||||||
|
<span class="fn__space"></span>
|
||||||
|
<input class="b3-switch fn__flex-center" id="editorMarkdownInlineSub" type="checkbox"${window.siyuan.config.editor.markdown.inlineSub ? " checked" : ""}/>
|
||||||
|
</label>
|
||||||
|
<label class="fn__flex b3-label">
|
||||||
|
<div class="fn__flex-1">
|
||||||
|
${window.siyuan.languages.editorMarkdownInlineTag}
|
||||||
|
<div class="b3-label__text">${window.siyuan.languages.editorMarkdownInlineTagTip}</div>
|
||||||
|
</div>
|
||||||
|
<span class="fn__space"></span>
|
||||||
|
<input class="b3-switch fn__flex-center" id="editorMarkdownInlineTag" type="checkbox"${window.siyuan.config.editor.markdown.inlineTag ? " checked" : ""}/>
|
||||||
|
</label>
|
||||||
|
<label class="fn__flex b3-label">
|
||||||
|
<div class="fn__flex-1">
|
||||||
|
${window.siyuan.languages.editorMarkdownInlineMath}
|
||||||
|
<div class="b3-label__text">${window.siyuan.languages.editorMarkdownInlineMathTip}</div>
|
||||||
|
</div>
|
||||||
|
<span class="fn__space"></span>
|
||||||
|
<input class="b3-switch fn__flex-center" id="editorMarkdownInlineMath" type="checkbox"${window.siyuan.config.editor.markdown.inlineMath ? " checked" : ""}/>
|
||||||
|
</label>
|
||||||
<label class="fn__flex b3-label">
|
<label class="fn__flex b3-label">
|
||||||
<div class="fn__flex-1">
|
<div class="fn__flex-1">
|
||||||
${window.siyuan.languages.justify}
|
${window.siyuan.languages.justify}
|
||||||
|
|
@ -296,8 +328,16 @@ export const editor = {
|
||||||
(editor.element.querySelector("#dynamicLoadBlocks") as HTMLInputElement).value = "1024";
|
(editor.element.querySelector("#dynamicLoadBlocks") as HTMLInputElement).value = "1024";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let markdown = {
|
||||||
|
inlineSup: (editor.element.querySelector("#editorMarkdownInlineSup") as HTMLInputElement).checked,
|
||||||
|
inlineSub: (editor.element.querySelector("#editorMarkdownInlineSub") as HTMLInputElement).checked,
|
||||||
|
inlineTag: (editor.element.querySelector("#editorMarkdownInlineTag") as HTMLInputElement).checked,
|
||||||
|
inlineMath: (editor.element.querySelector("#editorMarkdownInlineMath") as HTMLInputElement).checked
|
||||||
|
};
|
||||||
|
|
||||||
fetchPost("/api/setting/setEditor", {
|
fetchPost("/api/setting/setEditor", {
|
||||||
fullWidth: (editor.element.querySelector("#fullWidth") as HTMLInputElement).checked,
|
fullWidth: (editor.element.querySelector("#fullWidth") as HTMLInputElement).checked,
|
||||||
|
markdown: markdown,
|
||||||
justify: (editor.element.querySelector("#justify") as HTMLInputElement).checked,
|
justify: (editor.element.querySelector("#justify") as HTMLInputElement).checked,
|
||||||
rtl: (editor.element.querySelector("#rtl") as HTMLInputElement).checked,
|
rtl: (editor.element.querySelector("#rtl") as HTMLInputElement).checked,
|
||||||
readOnly: (editor.element.querySelector("#readOnly") as HTMLInputElement).checked,
|
readOnly: (editor.element.querySelector("#readOnly") as HTMLInputElement).checked,
|
||||||
|
|
@ -371,6 +411,7 @@ export const editor = {
|
||||||
item.editor.protyle.contentElement.removeAttribute("data-fullwidth");
|
item.editor.protyle.contentElement.removeAttribute("data-fullwidth");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
setInlineStyle();
|
setInlineStyle();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -25,8 +25,11 @@ export const setLute = (options: ILuteOptions) => {
|
||||||
lute.SetTag(true);
|
lute.SetTag(true);
|
||||||
lute.SetSuperBlock(true);
|
lute.SetSuperBlock(true);
|
||||||
lute.SetMark(true);
|
lute.SetMark(true);
|
||||||
lute.SetSup(true);
|
lute.SetSup(window.siyuan.config.editor.markdown.inlineSup);
|
||||||
lute.SetSub(true);
|
lute.SetSub(window.siyuan.config.editor.markdown.inlineSub);
|
||||||
|
lute.SetTag(window.siyuan.config.editor.markdown.inlineTag);
|
||||||
|
lute.SetInlineMath(window.siyuan.config.editor.markdown.inlineMath);
|
||||||
|
lute.SetGFMStrikethrough1(false);
|
||||||
lute.SetSpin(true);
|
lute.SetSpin(true);
|
||||||
lute.SetProtyleWYSIWYG(true);
|
lute.SetProtyleWYSIWYG(true);
|
||||||
if (options.lazyLoadImage) {
|
if (options.lazyLoadImage) {
|
||||||
|
|
|
||||||
28
app/src/types/config.d.ts
vendored
28
app/src/types/config.d.ts
vendored
|
|
@ -279,10 +279,38 @@ declare namespace Config {
|
||||||
trust: boolean;
|
trust: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SiYuan editor markdown related configuration
|
||||||
|
*/
|
||||||
|
interface IMarkdown {
|
||||||
|
/**
|
||||||
|
* Whether to enable the inline superscript
|
||||||
|
*/
|
||||||
|
inlineSup: boolean;
|
||||||
|
/**
|
||||||
|
* Whether to enable the inline subscript
|
||||||
|
*/
|
||||||
|
inlineSub: boolean;
|
||||||
|
/**
|
||||||
|
* Whether to enable the inline tag
|
||||||
|
*/
|
||||||
|
inlineTag: boolean;
|
||||||
|
/**
|
||||||
|
* Whether to enable the inline math
|
||||||
|
*/
|
||||||
|
inlineMath: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SiYuan editor related configuration
|
* SiYuan editor related configuration
|
||||||
*/
|
*/
|
||||||
export interface IEditor {
|
export interface IEditor {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Markdown configuration
|
||||||
|
*/
|
||||||
|
markdown: IMarkdown;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default number of backlinks to expand
|
* The default number of backlinks to expand
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
4
app/src/types/protyle.d.ts
vendored
4
app/src/types/protyle.d.ts
vendored
|
|
@ -202,6 +202,10 @@ declare class Lute {
|
||||||
|
|
||||||
public SetTag(enable: boolean): void;
|
public SetTag(enable: boolean): void;
|
||||||
|
|
||||||
|
public SetInlineMath(enable: boolean): void;
|
||||||
|
|
||||||
|
public SetGFMStrikethrough1(enable: boolean): void;
|
||||||
|
|
||||||
public SetMark(enable: boolean): void;
|
public SetMark(enable: boolean): void;
|
||||||
|
|
||||||
public SetSub(enable: boolean): void;
|
public SetSub(enable: boolean): void;
|
||||||
|
|
|
||||||
4
app/stage/protyle/js/lute/lute.min.js
vendored
4
app/stage/protyle/js/lute/lute.min.js
vendored
File diff suppressed because one or more lines are too long
|
|
@ -330,6 +330,8 @@ func setEditor(c *gin.Context) {
|
||||||
util.BroadcastByType("main", "readonly", 0, "", model.Conf.Editor.ReadOnly)
|
util.BroadcastByType("main", "readonly", 0, "", model.Conf.Editor.ReadOnly)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
util.MarkdownSettings = model.Conf.Editor.Markdown
|
||||||
|
|
||||||
ret.Data = model.Conf.Editor
|
ret.Data = model.Conf.Editor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,8 @@
|
||||||
|
|
||||||
package conf
|
package conf
|
||||||
|
|
||||||
|
import "github.com/siyuan-note/siyuan/kernel/util"
|
||||||
|
|
||||||
type Editor struct {
|
type Editor struct {
|
||||||
FontSize int `json:"fontSize"` // 字体大小
|
FontSize int `json:"fontSize"` // 字体大小
|
||||||
FontSizeScrollZoom bool `json:"fontSizeScrollZoom"` // 字体大小是否支持滚轮缩放
|
FontSizeScrollZoom bool `json:"fontSizeScrollZoom"` // 字体大小是否支持滚轮缩放
|
||||||
|
|
@ -48,6 +50,7 @@ type Editor struct {
|
||||||
OnlySearchForDoc bool `json:"onlySearchForDoc"` // 是否启用 [[ 仅搜索文档块
|
OnlySearchForDoc bool `json:"onlySearchForDoc"` // 是否启用 [[ 仅搜索文档块
|
||||||
BacklinkExpandCount int `json:"backlinkExpandCount"` // 反向链接默认展开数量
|
BacklinkExpandCount int `json:"backlinkExpandCount"` // 反向链接默认展开数量
|
||||||
BackmentionExpandCount int `json:"backmentionExpandCount"` // 反链提及默认展开数量
|
BackmentionExpandCount int `json:"backmentionExpandCount"` // 反链提及默认展开数量
|
||||||
|
Markdown *util.Markdown `json:"markdown"` // Markdown 配置
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
@ -83,5 +86,6 @@ func NewEditor() *Editor {
|
||||||
RTL: false,
|
RTL: false,
|
||||||
BacklinkExpandCount: 8,
|
BacklinkExpandCount: 8,
|
||||||
BackmentionExpandCount: 8,
|
BackmentionExpandCount: 8,
|
||||||
|
Markdown: util.MarkdownSettings,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ require (
|
||||||
github.com/88250/epub v0.0.0-20230830085737-c19055cd1f48
|
github.com/88250/epub v0.0.0-20230830085737-c19055cd1f48
|
||||||
github.com/88250/go-humanize v0.0.0-20240424102817-4f78fac47ea7
|
github.com/88250/go-humanize v0.0.0-20240424102817-4f78fac47ea7
|
||||||
github.com/88250/gulu v1.2.3-0.20240324024901-3c1bb82cba30
|
github.com/88250/gulu v1.2.3-0.20240324024901-3c1bb82cba30
|
||||||
github.com/88250/lute v1.7.7-0.20240425021622-7773b213b113
|
github.com/88250/lute v1.7.7-0.20240426034208-275376345554
|
||||||
github.com/88250/pdfcpu v0.3.14-0.20230401044135-c7369a99720c
|
github.com/88250/pdfcpu v0.3.14-0.20230401044135-c7369a99720c
|
||||||
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1
|
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1
|
||||||
github.com/ClarkThan/ahocorasick v0.0.0-20231011042242-30d1ef1347f4
|
github.com/ClarkThan/ahocorasick v0.0.0-20231011042242-30d1ef1347f4
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,8 @@ github.com/88250/go-sqlite3 v1.14.13-0.20231214121541-e7f54c482950 h1:Pa5hMiBceT
|
||||||
github.com/88250/go-sqlite3 v1.14.13-0.20231214121541-e7f54c482950/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
|
github.com/88250/go-sqlite3 v1.14.13-0.20231214121541-e7f54c482950/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
|
||||||
github.com/88250/gulu v1.2.3-0.20240324024901-3c1bb82cba30 h1:IeE4DVRWnVpcbMj7gGZoSMiBWs3h/ihiyOmualS1Mas=
|
github.com/88250/gulu v1.2.3-0.20240324024901-3c1bb82cba30 h1:IeE4DVRWnVpcbMj7gGZoSMiBWs3h/ihiyOmualS1Mas=
|
||||||
github.com/88250/gulu v1.2.3-0.20240324024901-3c1bb82cba30/go.mod h1:MUfzyfmbPrRDZLqxc7aPrVYveatTHRfoUa5TynPS0i8=
|
github.com/88250/gulu v1.2.3-0.20240324024901-3c1bb82cba30/go.mod h1:MUfzyfmbPrRDZLqxc7aPrVYveatTHRfoUa5TynPS0i8=
|
||||||
github.com/88250/lute v1.7.7-0.20240425021622-7773b213b113 h1:s4geGWFDTu1rF+/6p+AqODDhy7pS5KBgWGKTgPnJk70=
|
github.com/88250/lute v1.7.7-0.20240426034208-275376345554 h1:XwSEW6Jts20V/uOKBljMl2AFSPyPbpx+4pCRluKuVVk=
|
||||||
github.com/88250/lute v1.7.7-0.20240425021622-7773b213b113/go.mod h1:VDAzL8b+oCh+e3NAlmwwLzC53ten0rZlS8NboB7ljtk=
|
github.com/88250/lute v1.7.7-0.20240426034208-275376345554/go.mod h1:VDAzL8b+oCh+e3NAlmwwLzC53ten0rZlS8NboB7ljtk=
|
||||||
github.com/88250/pdfcpu v0.3.14-0.20230401044135-c7369a99720c h1:Dl/8S9iLyPMTElnWIBxmjaLiWrkI5P4a21ivwAn5pU0=
|
github.com/88250/pdfcpu v0.3.14-0.20230401044135-c7369a99720c h1:Dl/8S9iLyPMTElnWIBxmjaLiWrkI5P4a21ivwAn5pU0=
|
||||||
github.com/88250/pdfcpu v0.3.14-0.20230401044135-c7369a99720c/go.mod h1:S5YT38L/GCjVjmB4PB84PymA1qfopjEhfhTNQilLpv4=
|
github.com/88250/pdfcpu v0.3.14-0.20230401044135-c7369a99720c/go.mod h1:S5YT38L/GCjVjmB4PB84PymA1qfopjEhfhTNQilLpv4=
|
||||||
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1 h1:48T899JQDwyyRu9yXHePYlPdHtpJfrJEUGBMH3SMBWY=
|
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1 h1:48T899JQDwyyRu9yXHePYlPdHtpJfrJEUGBMH3SMBWY=
|
||||||
|
|
|
||||||
|
|
@ -267,6 +267,10 @@ func InitConf() {
|
||||||
if 0 > Conf.Editor.BackmentionExpandCount {
|
if 0 > Conf.Editor.BackmentionExpandCount {
|
||||||
Conf.Editor.BackmentionExpandCount = 0
|
Conf.Editor.BackmentionExpandCount = 0
|
||||||
}
|
}
|
||||||
|
if nil == Conf.Editor.Markdown {
|
||||||
|
Conf.Editor.Markdown = &util.Markdown{}
|
||||||
|
}
|
||||||
|
util.MarkdownSettings = Conf.Editor.Markdown
|
||||||
|
|
||||||
if nil == Conf.Export {
|
if nil == Conf.Export {
|
||||||
Conf.Export = conf.NewExport()
|
Conf.Export = conf.NewExport()
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,21 @@ import (
|
||||||
"github.com/siyuan-note/logging"
|
"github.com/siyuan-note/logging"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// MarkdownSettings 运行时 Markdown 配置。
|
||||||
|
var MarkdownSettings = &Markdown{
|
||||||
|
InlineSup: false,
|
||||||
|
InlineSub: false,
|
||||||
|
InlineTag: false,
|
||||||
|
InlineMath: false,
|
||||||
|
}
|
||||||
|
|
||||||
|
type Markdown struct {
|
||||||
|
InlineSup bool `json:"inlineSup"` // 是否启用行级上标
|
||||||
|
InlineSub bool `json:"inlineSub"` // 是否启用行级下标
|
||||||
|
InlineTag bool `json:"inlineTag"` // 是否启用行级标签
|
||||||
|
InlineMath bool `json:"inlineMath"` // 是否启用行级公式
|
||||||
|
}
|
||||||
|
|
||||||
func NewLute() (ret *lute.Lute) {
|
func NewLute() (ret *lute.Lute) {
|
||||||
ret = lute.New()
|
ret = lute.New()
|
||||||
ret.SetTextMark(true)
|
ret.SetTextMark(true)
|
||||||
|
|
@ -36,9 +51,12 @@ func NewLute() (ret *lute.Lute) {
|
||||||
ret.SetImgPathAllowSpace(true)
|
ret.SetImgPathAllowSpace(true)
|
||||||
ret.SetGitConflict(true)
|
ret.SetGitConflict(true)
|
||||||
ret.SetMark(true)
|
ret.SetMark(true)
|
||||||
ret.SetSup(true)
|
ret.SetSup(MarkdownSettings.InlineSup)
|
||||||
ret.SetSub(true)
|
ret.SetSub(MarkdownSettings.InlineSub)
|
||||||
|
ret.SetTag(MarkdownSettings.InlineTag)
|
||||||
|
ret.SetInlineMath(MarkdownSettings.InlineMath)
|
||||||
ret.SetInlineMathAllowDigitAfterOpenMarker(true)
|
ret.SetInlineMathAllowDigitAfterOpenMarker(true)
|
||||||
|
ret.SetGFMStrikethrough1(false)
|
||||||
ret.SetFootnotes(false)
|
ret.SetFootnotes(false)
|
||||||
ret.SetToC(false)
|
ret.SetToC(false)
|
||||||
ret.SetIndentCodeBlock(false)
|
ret.SetIndentCodeBlock(false)
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ import (
|
||||||
"github.com/siyuan-note/logging"
|
"github.com/siyuan-note/logging"
|
||||||
)
|
)
|
||||||
|
|
||||||
// UseSingleLineSave 是否使用单行保存 .sy 文件。
|
// UseSingleLineSave 是否使用单行保存 .sy 和数据库 .json 文件。
|
||||||
var UseSingleLineSave = true
|
var UseSingleLineSave = true
|
||||||
|
|
||||||
// IsUILoaded 是否已经加载了 UI。
|
// IsUILoaded 是否已经加载了 UI。
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue