Documentation
¶
Overview ¶
Package parser provides markdown parsing and VCTM generation
Index ¶
- func CalculateIntegrity(path string) (string, error)
- func OutputFileName(baseName, formatName string) string
- type ClaimDef
- type ClaimLocalization
- type DisplayLocalization
- type ImageRef
- type ParsedMarkdown
- type Parser
- func (p *Parser) Generate(cred *formats.ParsedCredential, formatNames []string) (map[string][]byte, error)
- func (p *Parser) GenerateAll(cred *formats.ParsedCredential) (map[string][]byte, error)
- func (p *Parser) Parse(inputPath string) (*ParsedMarkdown, error)
- func (p *Parser) ParseContent(content []byte, basePath string) (*ParsedMarkdown, error)
- func (p *Parser) ParseContentToCredential(content []byte, basePath string) (*formats.ParsedCredential, error)
- func (p *Parser) ParseToCredential(inputPath string) (*formats.ParsedCredential, error)
- func (p *Parser) ToCredential(parsed *ParsedMarkdown) *formats.ParsedCredential
- func (p *Parser) ToVCTM(parsed *ParsedMarkdown) (*vctm.VCTM, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculateIntegrity ¶
CalculateIntegrity is a public helper to calculate SRI integrity for a file
func OutputFileName ¶ added in v1.3.0
OutputFileName returns the output filename for a given format
Types ¶
type ClaimDef ¶
type ClaimDef struct {
// Name is the claim name
Name string
// Type is the value type
Type string
// Description is the claim description
Description string
// Mandatory indicates if the claim is mandatory
Mandatory bool
// SD indicates selective disclosure
SD string
// SvgId is the ID for SVG template reference
SvgId string
// DisplayName is the friendly display label for the claim
DisplayName string
// Localizations contains locale-specific display names and descriptions
Localizations map[string]ClaimLocalization
}
ClaimDef represents a claim definition
type ClaimLocalization ¶ added in v1.1.0
type ClaimLocalization struct {
// Label is the display label in this locale
Label string
// Description is the description in this locale
Description string
}
ClaimLocalization contains localized display information for a claim
type DisplayLocalization ¶ added in v1.2.0
type DisplayLocalization struct {
// Name is the localized credential name
Name string `yaml:"name"`
// Description is the localized credential description
Description string `yaml:"description"`
}
DisplayLocalization contains localized display properties for the credential
type ImageRef ¶
type ImageRef struct {
// Path is the original path in the markdown
Path string
// AltText is the alt text for the image
AltText string
// AbsolutePath is the resolved absolute path
AbsolutePath string
}
ImageRef represents a reference to an image
type ParsedMarkdown ¶
type ParsedMarkdown struct {
// Title is extracted from the first H1 heading
Title string
// Description is extracted from the first paragraph after the title
Description string
// Sections contains content organized by section headings
Sections map[string]string
// Images contains paths to images found in the markdown
Images []ImageRef
// Claims contains claim definitions extracted from the markdown
Claims map[string]ClaimDef
// Metadata contains front matter or metadata extracted from the markdown
Metadata map[string]string
// DisplayLocalizations contains locale-specific display properties for the credential
DisplayLocalizations map[string]DisplayLocalization
}
ParsedMarkdown represents the parsed structure from a markdown file
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser parses markdown files and generates VCTM
func (*Parser) Generate ¶ added in v1.3.0
func (p *Parser) Generate(cred *formats.ParsedCredential, formatNames []string) (map[string][]byte, error)
Generate generates output for the specified formats
func (*Parser) GenerateAll ¶ added in v1.3.0
GenerateAll generates output for all registered formats
func (*Parser) Parse ¶
func (p *Parser) Parse(inputPath string) (*ParsedMarkdown, error)
Parse parses a markdown file and returns the parsed structure
func (*Parser) ParseContent ¶
func (p *Parser) ParseContent(content []byte, basePath string) (*ParsedMarkdown, error)
ParseContent parses markdown content and returns the parsed structure
func (*Parser) ParseContentToCredential ¶ added in v1.3.0
func (p *Parser) ParseContentToCredential(content []byte, basePath string) (*formats.ParsedCredential, error)
ParseContentToCredential parses markdown content and returns a ParsedCredential
func (*Parser) ParseToCredential ¶ added in v1.3.0
func (p *Parser) ParseToCredential(inputPath string) (*formats.ParsedCredential, error)
ParseToCredential parses a markdown file and returns a ParsedCredential
func (*Parser) ToCredential ¶ added in v1.3.0
func (p *Parser) ToCredential(parsed *ParsedMarkdown) *formats.ParsedCredential
ToCredential converts ParsedMarkdown to the format-agnostic ParsedCredential