mirror of
https://github.com/rwinkhart/glamour-temp-MUTN.git
synced 2026-08-28 04:46:29 -04:00
Move chroma style settings to separate struct
This commit is contained in:
+31
-31
@@ -45,37 +45,37 @@ func (e *CodeBlockElement) Render(w io.Writer, ctx RenderContext) error {
|
||||
|
||||
styles.Register(chroma.MustNewStyle("charm",
|
||||
chroma.StyleEntries{
|
||||
chroma.Text: chromaColor(rules.Text),
|
||||
chroma.Error: chromaColor(rules.Error),
|
||||
chroma.Comment: chromaColor(rules.Comment),
|
||||
chroma.CommentPreproc: chromaColor(rules.CommentPreproc),
|
||||
chroma.Keyword: chromaColor(rules.Keyword),
|
||||
chroma.KeywordReserved: chromaColor(rules.KeywordReserved),
|
||||
chroma.KeywordNamespace: chromaColor(rules.KeywordNamespace),
|
||||
chroma.KeywordType: chromaColor(rules.KeywordType),
|
||||
chroma.Operator: chromaColor(rules.Operator),
|
||||
chroma.Punctuation: chromaColor(rules.Punctuation),
|
||||
chroma.Name: chromaColor(rules.Name),
|
||||
chroma.NameBuiltin: chromaColor(rules.NameBuiltin),
|
||||
chroma.NameTag: chromaColor(rules.NameTag),
|
||||
chroma.NameAttribute: chromaColor(rules.NameAttribute),
|
||||
chroma.NameClass: chromaColor(rules.NameClass),
|
||||
chroma.NameConstant: chromaColor(rules.NameConstant),
|
||||
chroma.NameDecorator: chromaColor(rules.NameDecorator),
|
||||
chroma.NameException: chromaColor(rules.NameException),
|
||||
chroma.NameFunction: chromaColor(rules.NameFunction),
|
||||
chroma.NameOther: chromaColor(rules.NameOther),
|
||||
chroma.Literal: chromaColor(rules.Literal),
|
||||
chroma.LiteralNumber: chromaColor(rules.LiteralNumber),
|
||||
chroma.LiteralDate: chromaColor(rules.LiteralDate),
|
||||
chroma.LiteralString: chromaColor(rules.LiteralString),
|
||||
chroma.LiteralStringEscape: chromaColor(rules.LiteralStringEscape),
|
||||
chroma.GenericDeleted: chromaColor(rules.GenericDeleted),
|
||||
chroma.GenericEmph: chromaColor(rules.GenericEmph),
|
||||
chroma.GenericInserted: chromaColor(rules.GenericInserted),
|
||||
chroma.GenericStrong: chromaColor(rules.GenericStrong),
|
||||
chroma.GenericSubheading: chromaColor(rules.GenericSubheading),
|
||||
chroma.Background: chromaColor(rules.Background),
|
||||
chroma.Text: chromaColor(rules.Chroma.Text),
|
||||
chroma.Error: chromaColor(rules.Chroma.Error),
|
||||
chroma.Comment: chromaColor(rules.Chroma.Comment),
|
||||
chroma.CommentPreproc: chromaColor(rules.Chroma.CommentPreproc),
|
||||
chroma.Keyword: chromaColor(rules.Chroma.Keyword),
|
||||
chroma.KeywordReserved: chromaColor(rules.Chroma.KeywordReserved),
|
||||
chroma.KeywordNamespace: chromaColor(rules.Chroma.KeywordNamespace),
|
||||
chroma.KeywordType: chromaColor(rules.Chroma.KeywordType),
|
||||
chroma.Operator: chromaColor(rules.Chroma.Operator),
|
||||
chroma.Punctuation: chromaColor(rules.Chroma.Punctuation),
|
||||
chroma.Name: chromaColor(rules.Chroma.Name),
|
||||
chroma.NameBuiltin: chromaColor(rules.Chroma.NameBuiltin),
|
||||
chroma.NameTag: chromaColor(rules.Chroma.NameTag),
|
||||
chroma.NameAttribute: chromaColor(rules.Chroma.NameAttribute),
|
||||
chroma.NameClass: chromaColor(rules.Chroma.NameClass),
|
||||
chroma.NameConstant: chromaColor(rules.Chroma.NameConstant),
|
||||
chroma.NameDecorator: chromaColor(rules.Chroma.NameDecorator),
|
||||
chroma.NameException: chromaColor(rules.Chroma.NameException),
|
||||
chroma.NameFunction: chromaColor(rules.Chroma.NameFunction),
|
||||
chroma.NameOther: chromaColor(rules.Chroma.NameOther),
|
||||
chroma.Literal: chromaColor(rules.Chroma.Literal),
|
||||
chroma.LiteralNumber: chromaColor(rules.Chroma.LiteralNumber),
|
||||
chroma.LiteralDate: chromaColor(rules.Chroma.LiteralDate),
|
||||
chroma.LiteralString: chromaColor(rules.Chroma.LiteralString),
|
||||
chroma.LiteralStringEscape: chromaColor(rules.Chroma.LiteralStringEscape),
|
||||
chroma.GenericDeleted: chromaColor(rules.Chroma.GenericDeleted),
|
||||
chroma.GenericEmph: chromaColor(rules.Chroma.GenericEmph),
|
||||
chroma.GenericInserted: chromaColor(rules.Chroma.GenericInserted),
|
||||
chroma.GenericStrong: chromaColor(rules.Chroma.GenericStrong),
|
||||
chroma.GenericSubheading: chromaColor(rules.Chroma.GenericSubheading),
|
||||
chroma.Background: chromaColor(rules.Chroma.Background),
|
||||
}))
|
||||
|
||||
iw := &IndentWriter{
|
||||
|
||||
+34
-32
@@ -37,38 +37,40 @@ type StyleBlock struct {
|
||||
|
||||
type StyleCodeBlock struct {
|
||||
StyleBlock
|
||||
Theme string `json:"theme"`
|
||||
Text StylePrimitive `json:"text"`
|
||||
Error StylePrimitive `json:"error"`
|
||||
Comment StylePrimitive `json:"comment"`
|
||||
CommentPreproc StylePrimitive `json:"comment_preproc"`
|
||||
Keyword StylePrimitive `json:"keyword"`
|
||||
KeywordReserved StylePrimitive `json:"keyword_reserved"`
|
||||
KeywordNamespace StylePrimitive `json:"keyword_namespace"`
|
||||
KeywordType StylePrimitive `json:"keyword_type"`
|
||||
Operator StylePrimitive `json:"operator"`
|
||||
Punctuation StylePrimitive `json:"punctuation"`
|
||||
Name StylePrimitive `json:"name"`
|
||||
NameBuiltin StylePrimitive `json:"name_builtin"`
|
||||
NameTag StylePrimitive `json:"name_tag"`
|
||||
NameAttribute StylePrimitive `json:"name_attribute"`
|
||||
NameClass StylePrimitive `json:"name_class"`
|
||||
NameConstant StylePrimitive `json:"name_constant"`
|
||||
NameDecorator StylePrimitive `json:"name_decorator"`
|
||||
NameException StylePrimitive `json:"name_exception"`
|
||||
NameFunction StylePrimitive `json:"name_function"`
|
||||
NameOther StylePrimitive `json:"name_other"`
|
||||
Literal StylePrimitive `json:"literal"`
|
||||
LiteralNumber StylePrimitive `json:"literal_number"`
|
||||
LiteralDate StylePrimitive `json:"literal_date"`
|
||||
LiteralString StylePrimitive `json:"literal_string"`
|
||||
LiteralStringEscape StylePrimitive `json:"literal_string_escape"`
|
||||
GenericDeleted StylePrimitive `json:"generic_deleted"`
|
||||
GenericEmph StylePrimitive `json:"generic_emph"`
|
||||
GenericInserted StylePrimitive `json:"generic_inserted"`
|
||||
GenericStrong StylePrimitive `json:"generic_strong"`
|
||||
GenericSubheading StylePrimitive `json:"generic_subheading"`
|
||||
Background StylePrimitive `json:"background"`
|
||||
Theme string `json:"theme"`
|
||||
Chroma struct {
|
||||
Text StylePrimitive `json:"text"`
|
||||
Error StylePrimitive `json:"error"`
|
||||
Comment StylePrimitive `json:"comment"`
|
||||
CommentPreproc StylePrimitive `json:"comment_preproc"`
|
||||
Keyword StylePrimitive `json:"keyword"`
|
||||
KeywordReserved StylePrimitive `json:"keyword_reserved"`
|
||||
KeywordNamespace StylePrimitive `json:"keyword_namespace"`
|
||||
KeywordType StylePrimitive `json:"keyword_type"`
|
||||
Operator StylePrimitive `json:"operator"`
|
||||
Punctuation StylePrimitive `json:"punctuation"`
|
||||
Name StylePrimitive `json:"name"`
|
||||
NameBuiltin StylePrimitive `json:"name_builtin"`
|
||||
NameTag StylePrimitive `json:"name_tag"`
|
||||
NameAttribute StylePrimitive `json:"name_attribute"`
|
||||
NameClass StylePrimitive `json:"name_class"`
|
||||
NameConstant StylePrimitive `json:"name_constant"`
|
||||
NameDecorator StylePrimitive `json:"name_decorator"`
|
||||
NameException StylePrimitive `json:"name_exception"`
|
||||
NameFunction StylePrimitive `json:"name_function"`
|
||||
NameOther StylePrimitive `json:"name_other"`
|
||||
Literal StylePrimitive `json:"literal"`
|
||||
LiteralNumber StylePrimitive `json:"literal_number"`
|
||||
LiteralDate StylePrimitive `json:"literal_date"`
|
||||
LiteralString StylePrimitive `json:"literal_string"`
|
||||
LiteralStringEscape StylePrimitive `json:"literal_string_escape"`
|
||||
GenericDeleted StylePrimitive `json:"generic_deleted"`
|
||||
GenericEmph StylePrimitive `json:"generic_emph"`
|
||||
GenericInserted StylePrimitive `json:"generic_inserted"`
|
||||
GenericStrong StylePrimitive `json:"generic_strong"`
|
||||
GenericSubheading StylePrimitive `json:"generic_subheading"`
|
||||
Background StylePrimitive `json:"background"`
|
||||
} `json:"chroma"`
|
||||
}
|
||||
|
||||
type StyleList struct {
|
||||
|
||||
Reference in New Issue
Block a user