Documentation
¶
Overview ¶
Package config provides configuration management for the markdown formatter.
Index ¶
Constants ¶
View Source
const ( // DefaultLineWidth defines the default maximum line width DefaultLineWidth = 80 // DefaultMaxBlankLines defines the default maximum consecutive blank lines DefaultMaxBlankLines = 2 // ConfigFilePermissions defines the file permissions for config files ConfigFilePermissions = 0o600 )
Variables ¶
This section is empty.
Functions ¶
func FindConfigFile ¶
FindConfigFile searches for configuration files in common locations
Types ¶
type CodeConfig ¶
type CodeConfig struct {
// FenceStyle defines the fence style: "“`" or "~~~"
FenceStyle string `yaml:"fence_style" json:"fence_style"`
// LanguageDetection enables automatic language detection
LanguageDetection bool `yaml:"language_detection" json:"language_detection"`
}
CodeConfig contains code block formatting options
type Config ¶
type Config struct {
// LineWidth is the maximum line width for text reflow
LineWidth int `yaml:"line_width" json:"line_width"`
// Heading configuration
Heading HeadingConfig `yaml:"heading" json:"heading"`
// List configuration
List ListConfig `yaml:"list" json:"list"`
// Code block configuration
Code CodeConfig `yaml:"code" json:"code"`
// Whitespace configuration
Whitespace WhitespaceConfig `yaml:"whitespace" json:"whitespace"`
// File processing configuration
Files FilesConfig `yaml:"files" json:"files"`
}
Config represents the configuration for mdfmt
func (*Config) IsMarkdownFile ¶
IsMarkdownFile checks if a file is a markdown file based on extension
func (*Config) LoadFromFile ¶
LoadFromFile loads configuration from a file.
func (*Config) SaveToFile ¶
SaveToFile saves configuration to a file.
func (*Config) ShouldIgnore ¶
ShouldIgnore checks if a file should be ignored based on patterns.
type FilesConfig ¶
type FilesConfig struct {
// Extensions defines which file extensions to process
Extensions []string `yaml:"extensions" json:"extensions"`
// IgnorePatterns defines glob patterns to ignore
IgnorePatterns []string `yaml:"ignore_patterns" json:"ignore_patterns"`
}
FilesConfig contains file processing options
type HeadingConfig ¶
type HeadingConfig struct {
// Style defines the heading style: "atx" (#) or "setext" (===)
Style string `yaml:"style" json:"style"`
// NormalizeLevels fixes heading level jumps
NormalizeLevels bool `yaml:"normalize_levels" json:"normalize_levels"`
}
HeadingConfig contains heading formatting options
type ListConfig ¶
type ListConfig struct {
// BulletStyle defines the bullet character: "-", "*", or "+"
BulletStyle string `yaml:"bullet_style" json:"bullet_style"`
// NumberStyle defines the numbering style: "." or ")"
NumberStyle string `yaml:"number_style" json:"number_style"`
// ConsistentIndentation ensures consistent indentation
ConsistentIndentation bool `yaml:"consistent_indentation" json:"consistent_indentation"`
}
ListConfig contains list formatting options
type WhitespaceConfig ¶
type WhitespaceConfig struct {
// MaxBlankLines defines maximum consecutive blank lines
MaxBlankLines int `yaml:"max_blank_lines" json:"max_blank_lines"`
// TrimTrailingSpaces removes trailing spaces
TrimTrailingSpaces bool `yaml:"trim_trailing_spaces" json:"trim_trailing_spaces"`
// EnsureFinalNewline ensures files end with a newline
EnsureFinalNewline bool `yaml:"ensure_final_newline" json:"ensure_final_newline"`
}
WhitespaceConfig contains whitespace handling options
Click to show internal directories.
Click to hide internal directories.