fork of anirudh.fi/vite that uses chroma for hl
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Separate syntax highlight configuration

+44 -18
+12 -6
markdown/markdown.go
··· 9 9 "git.icyphox.sh/vite/markdown/template" 10 10 11 11 bfc "github.com/Depado/bfchroma" 12 + "github.com/alecthomas/chroma/formatters/html" 12 13 bf "github.com/russross/blackfriday/v2" 13 14 ) 14 15 15 - var bfFlags = bf.UseXHTML | bf.Smartypants | bf.SmartypantsFractions | 16 - bf.SmartypantsDashes | bf.NofollowLinks 17 - var bfExts = bf.NoIntraEmphasis | bf.Tables | bf.FencedCode | bf.Autolink | 18 - bf.Strikethrough | bf.SpaceHeadings | bf.BackslashLineBreak | 19 - bf.HeadingIDs | bf.Footnotes | bf.NoEmptyLineBeforeBlock 16 + var ( 17 + bfFlags = bf.UseXHTML | bf.Smartypants | bf.SmartypantsFractions | 18 + bf.SmartypantsDashes | bf.NofollowLinks 19 + bfExts = bf.NoIntraEmphasis | bf.Tables | bf.FencedCode | bf.Autolink | 20 + bf.Strikethrough | bf.SpaceHeadings | bf.BackslashLineBreak | 21 + bf.HeadingIDs | bf.Footnotes | bf.NoEmptyLineBeforeBlock 22 + ) 20 23 21 24 type Output struct { 22 25 HTML []byte ··· 32 35 md.Body, 33 36 bf.WithRenderer( 34 37 bfc.NewRenderer( 35 - bfc.ChromaStyle(Icy), 38 + bfc.ChromaOptions( 39 + html.TabWidth(4), 40 + html.WithClasses(true), 41 + ), 36 42 bfc.Extend( 37 43 bf.NewHTMLRenderer(bf.HTMLRendererParameters{ 38 44 Flags: bfFlags,
+14 -4
markdown/style.go contrib/style.go
··· 1 - package markdown 1 + // style.go: generate chroma css 2 + // go run contrib/style.go > syntax.css 3 + package main 2 4 3 5 import ( 6 + "os" 7 + 4 8 "github.com/alecthomas/chroma" 9 + "github.com/alecthomas/chroma/formatters/html" 5 10 ) 6 11 7 - var Icy = chroma.MustNewStyle("icy", chroma.StyleEntries{ 12 + var syntax = chroma.MustNewStyle("syntax", chroma.StyleEntries{ 8 13 chroma.CommentMultiline: "italic #999988", 9 14 chroma.CommentPreproc: "bold #999999", 10 15 chroma.CommentSingle: "italic #999988", ··· 30 35 chroma.LiteralString: "#509c93", 31 36 chroma.NameAttribute: "#008080", 32 37 chroma.NameBuiltinPseudo: "#999999", 33 - chroma.NameBuiltin: "#0086B3", 38 + chroma.NameBuiltin: "#509c93", 34 39 chroma.NameClass: "bold #666666", 35 40 chroma.NameConstant: "#008080", 36 41 chroma.NameDecorator: "bold #3c5d5d", 37 - chroma.NameEntity: "#800080", 42 + chroma.NameEntity: "#509c93", 38 43 chroma.NameException: "bold #444444", 39 44 chroma.NameFunction: "bold #444444", 40 45 chroma.NameLabel: "bold #444444", ··· 48 53 chroma.TextWhitespace: "#bbbbbb", 49 54 chroma.Background: " bg:#ffffff", 50 55 }) 56 + 57 + func main() { 58 + formatter := html.New(html.WithClasses(true)) 59 + formatter.WriteCSS(os.Stdout, syntax) 60 + }
+18 -8
readme
··· 39 39 Example config: https://git.icyphox.sh/site/tree/config.yaml 40 40 41 41 42 + SYNTAX HIGHLIGHTING 43 + 44 + vite uses chroma (https://github.com/alecthomas/chroma) for syntax 45 + highlighting. Note that CSS is not provided, and will have to be 46 + included by the user in the templates. A sample style can be generated 47 + by running: 48 + 49 + go run contrib/style.go > syntax.css 50 + 51 + 42 52 TEMPLATING 43 53 44 54 Non-index templates have access to the below objects: ··· 62 72 |-- index.html 63 73 `-- project.html 64 74 65 - The templates under 'project/' are referenced as 'project/index.html'. 75 + The templates under project/ are referenced as project/index.html. 66 76 This deserves mention because Go templates don't recurse into 67 77 subdirectories by default (template.ParseGlob uses filepath.Glob, and 68 - doesn't support deep-matching, i.e. '**'). 78 + doesn't support deep-matching, i.e. **). 69 79 70 80 More templating examples can be found at: 71 81 https://git.icyphox.sh/site/tree/templates ··· 73 83 74 84 FEEDS 75 85 76 - Atom feeds are generated for all directories under 'pages/'. So 77 - 'pages/foo' will have a Atom feed at 'build/foo/feed.xml'. 86 + Atom feeds are generated for all directories under pages/. So 87 + pages/foo will have a Atom feed at build/foo/feed.xml. 78 88 79 89 80 90 FILE TREE ··· 86 96 |-- static/ 87 97 |-- templates/ 88 98 89 - The entire 'static/' directory gets copied over to 'build/', and can be 90 - used to reference static assets -- css, images, etc. 'pages/' supports 91 - only nesting one directory deep; for example: 'pages/blog/*.md' will 92 - render, but 'pages/blog/foo/*.md' will not. 99 + The entire static/ directory gets copied over to build/, and can be 100 + used to reference static assets -- css, images, etc. pages/ supports 101 + only nesting one directory deep; for example: pages/blog/*.md will 102 + render, but pages/blog/foo/*.md will not.