• hugo小玩


    hugo小玩

    1. 安装

    • install from source
    • by brew
    • install pre-built-binary

    2. 下载源码

    $ go get github.com/magefile/mage
    $ go get -d github.com/gohugoio/hugo
    $ cd ${GOPATH:-$HOME/go}/src/github.com/gohugoio/hugo
    $ mage vendor
    $ mage install
    

    疑难点:

    1. 依赖
      1. 该项目依赖了贼多的外部库 可以使用
        https://www.golangtc.com/download/package 辅助
    2. mage 自动更新
      1. mage在构建时,会自动更新 dep 工具,然而我的网络,你懂得,连不上 github.com/golang/dep
      2. 更新了dep之后,会报告dep构建失败,需要更新 go 版本

    我的目标

    我希望使用hugo来构建笔记,但我的笔记喜欢写 时序图流程图
    希望能在hugo上继续使用。
    一番翻找,发现hugo源码里面markdown或者其它文本使用 github.com/gohugoio/hugo/tpl 子库完成。

    主要关键函数

    func (c ContentSpec) RenderBytes(ctx *RenderingContext) []byte {
    	switch ctx.PageFmt {
    	default:
    		return c.markdownRender(ctx)
    	case "markdown":
    		return c.markdownRender(ctx)
    	case "asciidoc":
    		return getAsciidocContent(ctx)
    	case "mmark":
    		return c.mmarkRender(ctx)
    	case "rst":
    		return getRstContent(ctx)
    	case "org":
    		return orgRender(ctx, c)
    	case "pandoc":
    		return getPandocContent(ctx)
    	}
    }
    

    实际,平常使用肯定是 markdown 格式,
    hugo中解析 markdown 使用 blackfriday 库。

    通过 blackfriday 渲染过后,应该会类似其它语法,
    所以,理论上,应该是在 theme 中再加上几句 js 应该就能解决问题。

    待明日研究。

  • 相关阅读:
    redis基本操作 —— hash
    redis基本操作 —— string
    redis —— linux下源码安装
    zookeeper c api 安装 & 连接 zookeeper
    wpa_supplicant移植(2.9版本)
    hostapd移植(2.6版本为例)
    hostapd移植(2.7版本)
    使用MKdocs搭建个人主页并关联到GithubPages上
    yolov5的yaml文件解析
    RANSAC——(RANdom SAmple Consensus(随机抽样一致))
  • 原文地址:https://www.cnblogs.com/morya/p/9085721.html
Copyright © 2020-2023  润新知