Skip to content
/ md2doc Public template

Markdown.md to .docx/.pptx for my graduation paper. Because it's terrible to use Word, and I'm lazy on LaTeX grammar :P

Notifications You must be signed in to change notification settings

AClon314/md2doc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

link-citations link-bibliography plantuml-format plot-configuration chapters chaptersDepth figureTitle tableTitle titleDelim chapDelim figPrefix tblPrefix template autoFigLabels marp footer paginate
true
true
svg
conf/plot.yaml
true
1
-
conf/ncu.docx
true
false
2025-05-23
true
<style> <style> ._ .I img { width: 150vw; } .fit { width: fit-content; } .flex{ display:flex; } ._ { display:flex; flex-direction: row; } .I { display:flex; flex-direction: column; } section{ padding: 1.5em; } figcaption{ font-size: 20px; text-align: center; } /* span.hljs-function{ display:grid; } */ .hide { display:none; } </style>

abstract

基于pandoc的markdown转word论文模板
子标题Subtitle
专 业:计算机     学 号:20241015 学生姓名:aclon     指导教师:大张伟
2025年
摘要

上面的摘要标题使用了 custom-style 而非直接使用 ## 标题是为了防止被自动编号。使用 {.unnumbered}/{-} 尽管可以实现标题不会被编号,但是下一个标题的编号然会算上这个标题继续编号,所以使用了 custom-style 直接指定 Word 样式。

安装 Install

git clone https://github.com/AClon314/md2doc

wget https://github.com/lierdakil/pandoc-crossref/releases/latest/download/pandoc-crossref-Linux-X64.tar.xz # 自动编号,下载后解压到PATH

wget https://github.com/LaurentRDC/pandoc-plot/releases/latest/download/pandoc-plot-Linux-x86_64.zip
sudo dnf install graphviz # 还需要手动安装plantuml,见下方

# pip install pandoc-tex-numbering  # tex → other

# npm install -g puppeteer pandoc-mermaid-chartjs-filter
# pnpm approve-builds -g
# sudo dnf install giflib-devel # linux依赖:apt install libgif-dev; yay giflib

plantuml

  1. 下载最新包,解压:windows
  2. plantuml(full)或plantuml-headless创建软链接到$PATH,windows下可以是C:\Windows,linux下可以是~/.local/bin(需要在.bashrc里添加PATH=...:$PATH)
  3. 测试
plantuml -version
PlantUML version 1.2025.2 (Wed Jan 08 01:35:36 CST 2025)
(GPLv2 source distribution)
Java Runtime: GraalVM Runtime Environment
JVM: Substrate VM
Default Encoding: UTF-8
Language: null
Country: null
 
PLANTUML_LIMIT_SIZE: 4096

Dot version: dot - graphviz version 12.2.1 (20241206.2353)
Installation seems OK. File generation OK

用法 Usage

在同目录下运行:

./convert.py README.md

./convert.py -h 查看帮助 ./conver.py --diy 可以导出docx模板,记得再另存为一次。

感谢原教程[@pandoc_template_example]: https://st1020.com/write-thesis-with-markdown-part1/ [@ref_standard] [@md2pptx]

必读文档 Must Read

👍 draw.io 流程图后期编辑: 支持导入 mermaid plantuml sql csv

default table style 默认表格样式,✅MS-Word,❌WPS

markdown转markdown:$toc$自定义目录位置

用markdown写论文@geChunYu

用markdown写论文@st1020

关键词: Markdown;Pandoc

\newpage

Based on pandoc word template
Abstract

Write abstract here.

Key Words: Markdown; Pandoc


Heading 1

Heading 2

Heading 3

Heading 4

Heading 5
Heading 6

首段落 First Paragraph. 正文Normal, 正文字体Body Text. Verbatim Char代码字体 超链接Hyperlink 脚注Footnote 1

Bold Italic Delete

  1. 有序列表
    1. 11
      1. 111
        1. 1111
          1. 11111
            1. 111111
    2. 12
  2. 2
  • 无序列表
    • 11
      • 111
        • 1111
          • 11111
            • 111111
    • 12
  • 2

如表[@tbl:table]。如图[@fig:ID]。

Compact b
1 2
: simple_tables see https://pandoc.org/chunkedhtml-demo/8.9-tables.html {#tbl:table}

::: {custom-style="Figure"}

a b
1 2
表{} 表名
:::

invert{#fig:ID}

digraph G {
    rankdir=TB;
    subgraph L {
        rank = same;
        b -> a [dir=back];  // b ← a
    }
    subgraph R {
        rank = same;
        c -> d;  // c → d
    }
    b -> c
}
%%{init: {'flowchart': {'padding': 0, 'useMaxWidth': false, 'htmlLabels': false}} }%%
flowchart LR
    A[Source] --> B{Condition}
Loading
zenuml
    title optional
    Alice->Bob: Hi Bob
    Bob->Alice: Hi Alice
Loading
@startuml
Bob->Alice: Hi Alice
@enduml
{
  "type": "pie",
  "data": {
    "labels": [
      "Red",
      "Blue",
      "Yellow"
    ],
    "datasets": [
      {
        "data": [
          300,
          50,
          100
        ],
        "backgroundColor": [
          "#FF6384",
          "#36A2EB",
          "#FFCE56"
        ],
        "hoverBackgroundColor": [
          "#FF6384",
          "#36A2EB",
          "#FFCE56"
        ]
      }
    ]
  },
  "options": {}
}

quote

#!/bin/env python
if __name__ == "__main__":
    print("👻")

\newpage

参考文献

::: {#refs} :::

Footnotes

  1. footnote.

About

Markdown.md to .docx/.pptx for my graduation paper. Because it's terrible to use Word, and I'm lazy on LaTeX grammar :P

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published