🎨 导出 Markdown 时在文档头添加 YFM 开关 https://github.com/siyuan-note/siyuan/issues/7727
This commit is contained in:
parent
1e11df1222
commit
35a52dd260
9 changed files with 26 additions and 0 deletions
|
@ -718,6 +718,8 @@
|
|||
"export20": "Exporting Word .docx files requires format conversion using <a href=\"https://pandoc.org\" target=\"_blank\">Pandoc</a>",
|
||||
"export21": "Export PDF with footer",
|
||||
"export22": "After enabling, add <code class='fn__code'>Export by SiYuan</code> at the footer of the exported PDF",
|
||||
"export23": "Export Markdown wit YFM",
|
||||
"export24": "After enabling, add some general metadata information at the beginning of the exported Markdown file",
|
||||
"blockRef": "Ref Block",
|
||||
"theme11": "Use theme in light mode",
|
||||
"theme12": "Use theme in dark mode",
|
||||
|
|
|
@ -718,6 +718,8 @@
|
|||
"export20": "La exportación de archivos Word .docx requiere la conversión del formato mediante <a href=\"https://pandoc.org\" target=\"_blank\">Pandoc</a>",
|
||||
"export21": "Exportar PDF con pie de página",
|
||||
"export22": "Después de habilitar, agregue <code class='fn__code'>Exportar por SiYuan</code> al pie de página del PDF exportado",
|
||||
"export23": "Exportar descuento con YFM",
|
||||
"export24": "Después de habilitar, agregue información general de metadatos al comienzo del archivo Markdown exportado",
|
||||
"blockRef": "Bloque de referencia",
|
||||
"theme11": "Usar tema en modo claro",
|
||||
"theme12": "Usar tema en modo oscuro",
|
||||
|
|
|
@ -718,6 +718,8 @@
|
|||
"export20": "L'exportation de fichiers Word .docx nécessite une conversion de format à l'aide de <a href=\"https://pandoc.org\" target=\"_blank\">Pandoc</a>",
|
||||
"export21": "Exporter un PDF avec pied de page",
|
||||
"export22": "Après l'activation, ajoutez <code class='fn__code'>Exporter par SiYuan</code> au pied de page du PDF exporté",
|
||||
"export23": "Exporter Markdown avec YFM",
|
||||
"export24": "Après l'activation, ajoutez des informations générales sur les métadonnées au début du fichier Markdown exporté",
|
||||
"blockRef": "Bloc Réf",
|
||||
"theme11": "Utiliser le thème en mode Clair",
|
||||
"theme12": "Utiliser le thème en mode sombre",
|
||||
|
|
|
@ -718,6 +718,8 @@
|
|||
"export20": "導出 Word .docx 文件需要使用 <a href=\"https://pandoc.org\" target=\"_blank\">Pandoc</a> 進行格式轉換",
|
||||
"export21": "導出 PDF 添加頁腳",
|
||||
"export22": "開啟後在導出的 PDF 頁腳處添加 <code class='fn__code'>由思源筆記導出</code>",
|
||||
"export23": "導出 Markdown 添加 YFM",
|
||||
"export24": "啟用後在導出的 Markdown 文件開頭處添加一些較為通用的元數據信息",
|
||||
"blockRef": "引用塊",
|
||||
"theme11": "淺色模式下使用主題",
|
||||
"theme12": "深色模式下使用主題",
|
||||
|
|
|
@ -718,6 +718,8 @@
|
|||
"export20": "导出 Word .docx 文件需要使用 <a href=\"https://pandoc.org\" target=\"_blank\">Pandoc</a> 进行格式转换",
|
||||
"export21": "导出 PDF 添加页脚",
|
||||
"export22": "启用后在导出的 PDF 页脚处添加 <code class='fn__code'>由思源笔记导出</code>",
|
||||
"export23": "导出 Markdown 添加 YFM",
|
||||
"export24": "启用后在导出的 Markdown 文件开头处添加一些较为通用的元数据信息",
|
||||
"blockRef": "引用块",
|
||||
"theme11": "明亮模式下使用主题",
|
||||
"theme12": "暗黑模式下使用主题",
|
||||
|
|
|
@ -35,6 +35,14 @@ export const exportConfig = {
|
|||
<span class="fn__space"></span>
|
||||
<input class="b3-switch fn__flex-center" id="addFooter" type="checkbox"${window.siyuan.config.export.addFooter ? " checked" : ""}/>
|
||||
</label>
|
||||
<label class="fn__flex b3-label">
|
||||
<div class="fn__flex-1">
|
||||
${window.siyuan.languages.export23}
|
||||
<div class="b3-label__text">${window.siyuan.languages.export24}</div>
|
||||
</div>
|
||||
<span class="fn__space"></span>
|
||||
<input class="b3-switch fn__flex-center" id="markdownYFM" type="checkbox"${window.siyuan.config.export.markdownYFM ? " checked" : ""}/>
|
||||
</label>
|
||||
<label class="fn__flex b3-label config__item">
|
||||
<div class="fn__flex-1">
|
||||
${window.siyuan.languages.blockRef}
|
||||
|
@ -130,6 +138,7 @@ export const exportConfig = {
|
|||
paragraphBeginningSpace: (exportConfig.element.querySelector("#paragraphBeginningSpace") as HTMLInputElement).checked,
|
||||
addTitle: (exportConfig.element.querySelector("#addTitle") as HTMLInputElement).checked,
|
||||
addFooter: (exportConfig.element.querySelector("#addFooter") as HTMLInputElement).checked,
|
||||
markdownYFM: (exportConfig.element.querySelector("#markdownYFM") as HTMLInputElement).checked,
|
||||
blockRefMode: parseInt((exportConfig.element.querySelector("#blockRefMode") as HTMLSelectElement).value, 10),
|
||||
blockEmbedMode: parseInt((exportConfig.element.querySelector("#blockEmbedMode") as HTMLSelectElement).value, 10),
|
||||
fileAnnotationRefMode: parseInt((exportConfig.element.querySelector("#fileAnnotationRefMode") as HTMLSelectElement).value, 10),
|
||||
|
|
1
app/src/types/index.d.ts
vendored
1
app/src/types/index.d.ts
vendored
|
@ -306,6 +306,7 @@ declare interface IExport {
|
|||
paragraphBeginningSpace: boolean;
|
||||
addTitle: boolean;
|
||||
addFooter: boolean;
|
||||
markdownYFM: boolean;
|
||||
}
|
||||
|
||||
declare interface IEditor {
|
||||
|
|
|
@ -28,6 +28,7 @@ type Export struct {
|
|||
TagCloseMarker string `json:"tagCloseMarker"` // 标签结束标记符,默认是 #
|
||||
FileAnnotationRefMode int `json:"fileAnnotationRefMode"` // 文件标注引用导出模式,0:文件名 - 页码 - 锚文本,1:仅锚文本
|
||||
PandocBin string `json:"pandocBin"` // Pandoc 可执行文件路径
|
||||
MarkdownYFM bool `json:"markdownYFM"` // Markdown 导出时是否添加 YAML Front Matter https://github.com/siyuan-note/siyuan/issues/7727
|
||||
}
|
||||
|
||||
func NewExport() *Export {
|
||||
|
@ -43,5 +44,6 @@ func NewExport() *Export {
|
|||
TagCloseMarker: "#",
|
||||
FileAnnotationRefMode: 0,
|
||||
PandocBin: "",
|
||||
MarkdownYFM: false,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1165,6 +1165,10 @@ func exportMarkdownZip(boxID, baseFolderName string, docPaths []string) (zipPath
|
|||
|
||||
func yfm(docIAL map[string]string) string {
|
||||
// 导出 Markdown 文件时开头附上一些元数据 https://github.com/siyuan-note/siyuan/issues/6880
|
||||
// 导出 Markdown 时在文档头添加 YFM 开关https://github.com/siyuan-note/siyuan/issues/7727
|
||||
if !Conf.Export.MarkdownYFM {
|
||||
return ""
|
||||
}
|
||||
|
||||
buf := bytes.Buffer{}
|
||||
buf.WriteString("---\n")
|
||||
|
|
Loading…
Add table
Reference in a new issue