mirror of
https://github.com/fengxxc/wechatmp2markdown.git
synced 2026-03-04 03:30:48 +08:00
feat: 添加markdown保存到文件的方法和程序入口
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package format
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"strconv"
|
||||
|
||||
"github.com/fengxxc/wechatmp2markdown/parse"
|
||||
@@ -19,6 +20,11 @@ func Format(article parse.Article) string {
|
||||
return result
|
||||
}
|
||||
|
||||
func FormatAndSave(article parse.Article, filePath string) {
|
||||
var result string = Format(article)
|
||||
ioutil.WriteFile(filePath, []byte(result), 0644)
|
||||
}
|
||||
|
||||
func formatTitle(piece parse.Piece) string {
|
||||
var prefix string
|
||||
level, _ := strconv.Atoi(piece.Attrs["level"])
|
||||
|
||||
Reference in New Issue
Block a user