Golang小貼士 -
Golang 語雀內容系統(5) Toc導航欄
實現功能
增加文章詳情頁Toc文章目錄
實現思路
對文章內容提取 h1, h2, h3, h4, h5 標籤與錨,這裏我們將採用到第三方包
github.com/PuerkitoBio/goquery
// handler/post.go
html = `
h1 id="H55oy1"語雀文章內容/h1
h2 id="H55oy2"語雀文章內容/h2
h3 id="H55oy3"語
blog
,
博客搭建
,
go
Golang小貼士 -
Golang 語雀內容系統(2) - 增加服務層語雀SDK
實現功能
繼上一節,我們完成了基本的web服務。
本節我們根據語雀開放文檔 https://www.yuque.com/yuque/developer/api,
新增以下功能
語雀文章詳情
語雀列表
語雀搜索
代碼實現
本節完整代碼,參考:https://github.com/golangtips...
增加 servcie 層,並創建以下文件
service/intf/
blog
,
go