在做App檢測方法時(shí),采用了MarkDown格式進(jìn)行文檔編寫。領(lǐng)導(dǎo)要求導(dǎo)出的PDF文件需要增加導(dǎo)航,方面閱讀。網(wǎng)站找了很多方法,終于找到了一個(gè)好用的:wkhtmltopdf.exe。
安裝 wkhtmltopdf
官方下載地址(慢的很):https://wkhtmltopdf.org/downloads.html
John提供下載地址: 暫不提供
下載完成之后,安裝,默認(rèn)安裝即可。
軟件安裝完成之后,可以將對應(yīng)目錄添加到環(huán)境變量。
C:\Program Files\wkhtmltopdf\bin
Markdown PDF插件
在vscode 中,搜索并安裝Markdown PDF。

image
導(dǎo)出html
編寫好 markdown 文檔后,鼠標(biāo)右鍵,選擇導(dǎo)出為html!

image
然后文件就被導(dǎo)出到當(dāng)前 md 所在目錄的相同文件名。
轉(zhuǎn)換為PDF
需要先下載工具: wkhtmltopdf.exe(見文章開頭)
CMD中,輸入以下命令完成轉(zhuǎn)換
wkhtmltopdf --disable-smart-shrinking html絕對路徑 PDF絕對路徑
例如:
"C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe" --disable-smart-shrinking D:\BASE\AppCheck\檢測方法.html D:\BASE\AppCheck\檢測方法.pdf
更新
還有一個(gè)同事推薦的所見即所得的工具:Typora,也是可以到處帶導(dǎo)航的PDF