Documentation
¶
Overview ¶
Package convert provides utilities for migrating legacy cheat sheet formats (such as .navi) into the standard Markdown-based AST format used by cheatmd.
Index ¶
- func ConvertCheat(content string, filename string) (string, error)
- func ConvertDirectory(format, inputDir, outputDir string) error
- func ConvertFile(format, inputPath, outputPath string) error
- func ConvertNavi(content string, filename string) (string, error)
- func ConvertNaviDirectory(inputDir, outputDir string) error
- func ConvertTldr(content string, filename string) (string, error)
- func SerializeNaviFile(file *NaviFile, idx *NaviIndex) string
- type CheatEntry
- type NaviCheat
- type NaviFile
- type NaviIndex
- type NaviResult
- type NaviSection
- type NaviSource
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertCheat ¶
ConvertCheat converts a cheat/cheat plain-text cheatsheet to CheatMD format.
func ConvertDirectory ¶
ConvertDirectory scans the input directory for legacy cheat sheet files matching the specified format (e.g., "navi") and converts them into standard cheatmd Markdown files in the output directory.
func ConvertFile ¶
ConvertFile converts a single file of the given format.
func ConvertNavi ¶
ConvertNavi converts a single navi .cheat file with no cross-file context. `@extends` references that can't be resolved within this file fall back to inline bare vars.
func ConvertNaviDirectory ¶
ConvertNaviDirectory walks every .cheat file in inputDir, parses them all into a shared NaviIndex (so @extends references can resolve across files), and writes one converted markdown file per source under outputDir.
func ConvertTldr ¶
ConvertTldr converts a TLDR markdown cheatsheet to CheatMD format.
func SerializeNaviFile ¶
SerializeNaviFile renders a file as cheatmd markdown. Cheats are emitted in section order, and each section's export module follows its cheats so the reader can see definitions next to the cheats that use them.
Types ¶
type CheatEntry ¶
CheatEntry is a single parsed entry from a cheat/cheat plain-text file.
type NaviCheat ¶
type NaviCheat struct {
}
NaviCheat is a single parsed entry from a navi `.cheat` file. Imports holds the section-level `@ extends` tags inherited at parse time plus any cheat-level `@` lines added after the heading.
type NaviFile ¶
type NaviFile struct {
}
NaviFile is one parsed navi cheat file: an ordered list of sections.
func ParseNaviFile ¶
ParseNaviFile parses a navi file into a NaviFile with per-section structure. Empty leading sections (no cheats, no vars) are dropped so they don't show up in the index as anonymous noise.
type NaviIndex ¶
type NaviIndex struct {
}
NaviIndex resolves cross-file `@extends` references at section granularity. A single tag may appear under sections in many files, and `@tag` reaches every one of them.
func BuildNaviIndex ¶
BuildNaviIndex registers every section under each of its tags so a cheat's `@extends` list can fan out to every matching section across the tree.
type NaviResult ¶
type NaviResult struct {
}
NaviResult represents the intermediate parsing state of a single .navi file before it is serialized into the final cheatmd Markdown AST.
func ConvertNaviTree ¶
func ConvertNaviTree(sources []NaviSource) []NaviResult
ConvertNaviTree converts every navi cheat file in a tree using a shared index, so `@extends` references can resolve var defs in sibling files.
type NaviSection ¶
type NaviSection struct {
// list so multiple `% tag1, tag2` blocks in the same file produce
// distinct module names instead of collapsing into a single file-wide
// module.
Module string
}
NaviSection is a `% tags` scope: every cheat declared until the next `%` shares this section's Vars and contributes to its Module's export. Sections are the granularity at which `@extends` resolves — a cheat with `@tag` reaches sections (across any file) whose Tags list contains `tag`.