zoukankan      html  css  js  c++  java
  • 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 应该就能解决问题。

    待明日研究。

  • 相关阅读:
    【转】忘记密码功能的安全实现(邮件方式)
    windows7下安装gem包---bcrypt-ruby
    Ruby中的%表示法
    ruby中特殊的全局变量
    rails中一个窗体多个模型——fields_for
    【转】深刻理解render 和 redirect_to
    UML核心元素--分析类
    UML核心元素--包
    UML核心元素--边界
    UML核心元素--用例
  • 原文地址:https://www.cnblogs.com/morya/p/9085721.html
Copyright © 2011-2022 走看看