ssgen

package module
v0.0.0-...-0403682 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2023 License: MIT Imports: 16 Imported by: 0

README

github.com/TwilightUncle/ssgen

静的サイト生成。
主にマークダウンをHTMLに変換。

利用モジュール

  • github.com/gin-gonic/gin
  • github.com/russross/blackfriday

パッケージダウンロード

go mod tidy

サイト内リンク用のMD記法

1. <str>を表示し、<str>に該当する画面(マークダウン)のリンクを生成
[{str}]

2. <str>を表示し、<str>に合致する見出し要素へのリンクを生成
[{str#}]

3. <str>を表示し、<path>に合致する画面(マークダウン)のリンクを生成
[{str|path}]

4. <str>を表示し、<id>に合致する見出し要素へのリンクを生成
[{str#id}]

5. <str>を表示し、<path>に該当する画面(マークダウン)中の<id>の見出しへのリンクを生成
[{str|path#id}]

オプション

  • -preview - サーバーを起動し、動的サーバーとしてレンダリングを行う
  • -preview-static - 静的サイトの構築と出力を行ったうえで、静的ファイルを返すだけのサーバーを起動する
  • オプションなし - 静的サイトの構築と出力のみ

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build

func Build() error

preview の場合はプレビュー用のサーバーを起動する

func BuildStaticSite

func BuildStaticSite() error

静的サイトを出力

func Default

func Default(baseUrl string, mdBaseDir string, assetsPath string, templateDir string, outputDir string) error

デフォルトの設定。引数にはマークダウンを格納しているディレクトリと、cssやjs等の静的ファイルを格納するPATH(ディレクトリ,URL共用)を指定

func Initialize

func Initialize(fn func(core *Core) error) error

任意の処理による初期化

func RunPreviewServer

func RunPreviewServer() error

プレビュー用サーバー起動

func RunPreviewStatic

func RunPreviewStatic() error

静的ファイル生成の上、プレビュー

Types

type Core

type Core struct {
	// htmlへ返還前のマークダウンに対して行う処理リスト
	MdMiddlewareList middleware.MiddlewareList
	// 変換後のhtmlに対して行う処理リスト
	HtmlMiddlewareList middleware.MiddlewareList
	MdPaths            access_md.MdPaths
	LayoutBuilder      LayoutBuilder

	BaseUrl          string
	AssetsPath       string
	TemplateDir      string
	TemplateHtmlName string
	OutputDir        string
	UrlSuffix        string
	// contains filtered or unexported fields
}

type LayoutBuilder

type LayoutBuilder func(metaData md_parse.MetaData, convertedHtml template.HTML) gin.H

func MakeDefaultLayoutBuilder

func MakeDefaultLayoutBuilder(baseUrl string, assetsPath string, mdLayoutDir string) (LayoutBuilder, error)

テンプレートの組み上げ

Directories

Path Synopsis
features
helpers

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL