hugo

Fork of github.com/gohugoio/hugo with reverse pagination support

git clone git://git.shimmy1996.com/hugo.git

config.go (2411B)

    1 // Copyright 2019 The Hugo Authors. All rights reserved.
    2 //
    3 // Licensed under the Apache License, Version 2.0 (the "License");
    4 // you may not use this file except in compliance with the License.
    5 // You may obtain a copy of the License at
    6 // http://www.apache.org/licenses/LICENSE-2.0
    7 //
    8 // Unless required by applicable law or agreed to in writing, software
    9 // distributed under the License is distributed on an "AS IS" BASIS,
   10 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   11 // See the License for the specific language governing permissions and
   12 // limitations under the License.
   13 
   14 // Package goldmark_config holds Goldmark related configuration.
   15 package goldmark_config
   16 
   17 const (
   18 	AutoHeadingIDTypeGitHub      = "github"
   19 	AutoHeadingIDTypeGitHubAscii = "github-ascii"
   20 	AutoHeadingIDTypeBlackfriday = "blackfriday"
   21 )
   22 
   23 // DefaultConfig holds the default Goldmark configuration.
   24 var Default = Config{
   25 	Extensions: Extensions{
   26 		Typographer:     true,
   27 		Footnote:        true,
   28 		DefinitionList:  true,
   29 		Table:           true,
   30 		Strikethrough:   true,
   31 		Linkify:         true,
   32 		LinkifyProtocol: "https",
   33 		TaskList:        true,
   34 	},
   35 	Renderer: Renderer{
   36 		Unsafe: false,
   37 	},
   38 	Parser: Parser{
   39 		AutoHeadingID:     true,
   40 		AutoHeadingIDType: AutoHeadingIDTypeGitHub,
   41 		Attribute: ParserAttribute{
   42 			Title: true,
   43 			Block: false,
   44 		},
   45 	},
   46 }
   47 
   48 // Config configures Goldmark.
   49 type Config struct {
   50 	Renderer   Renderer
   51 	Parser     Parser
   52 	Extensions Extensions
   53 }
   54 
   55 type Extensions struct {
   56 	Typographer    bool
   57 	Footnote       bool
   58 	DefinitionList bool
   59 
   60 	// GitHub flavored markdown
   61 	Table           bool
   62 	Strikethrough   bool
   63 	Linkify         bool
   64 	LinkifyProtocol string
   65 	TaskList        bool
   66 }
   67 
   68 type Renderer struct {
   69 	// Whether softline breaks should be rendered as '<br>'
   70 	HardWraps bool
   71 
   72 	// XHTML instead of HTML5.
   73 	XHTML bool
   74 
   75 	// Allow raw HTML etc.
   76 	Unsafe bool
   77 }
   78 
   79 type Parser struct {
   80 	// Enables custom heading ids and
   81 	// auto generated heading ids.
   82 	AutoHeadingID bool
   83 
   84 	// The strategy to use when generating heading IDs.
   85 	// Available options are "github", "github-ascii".
   86 	// Default is "github", which will create GitHub-compatible anchor names.
   87 	AutoHeadingIDType string
   88 
   89 	// Enables custom attributes.
   90 	Attribute ParserAttribute
   91 }
   92 
   93 type ParserAttribute struct {
   94 	// Enables custom attributes for titles.
   95 	Title bool
   96 	// Enables custom attributeds for blocks.
   97 	Block bool
   98 }