// NewParser returns a properly configured Markdown parser. func NewParser() *md.Parser { … } // CheckFragment reports problems in a release-note fragment. func CheckFragment(data string) error { … } // text returns all the text in a block, without any formatting. func text(b md.Block) string { … } // blocksText returns all the text in a slice of block nodes. func blocksText(bs []md.Block) string { … } // inlineText returns all the next in a slice of inline nodes. func inlineText(ins []md.Inline) string { … } // Merge combines the markdown documents (files ending in ".md") in the tree rooted // at fs into a single document. // The blocks of the documents are concatenated in lexicographic order by filename. // Heading with no content are removed. // The link keys must be unique, and are combined into a single map. // // Files in the "minor changes" directory (the unique directory matching the glob // "*stdlib/*minor") are named after the package to which they refer, and will have // the package heading inserted automatically and links to other standard library // symbols expanded automatically. For example, if a file *stdlib/minor/bytes/f.md // contains the text // // [Reader] implements [io.Reader]. // // then that will become // // [Reader](/pkg/bytes#Reader) implements [io.Reader](/pkg/io#Reader). func Merge(fsys fs.FS) (*md.Document, error) { … } // stdlibPackage returns the standard library package for the given filename. // If the filename does not represent a package, it returns the empty string. // A filename represents package P if it is in a directory matching the glob // "*stdlib/*minor/P". func stdlibPackage(filename string) string { … } func stdlibPackageHeading(pkg string, lastLine int) *md.Heading { … } // removeEmptySections removes headings with no content. A heading has no content // if there are no blocks between it and the next heading at the same level, or the // end of the document. func removeEmptySections(bs []md.Block) []md.Block { … } func sortedMarkdownFilenames(fsys fs.FS) ([]string, error) { … } // lastBlock returns the last block in the document. // It panics if the document has no blocks. func lastBlock(doc *md.Document) md.Block { … } // addLines adds n lines to the position of b. // n can be negative. func addLines(b md.Block, n int) { … } func position(b md.Block) *md.Position { … } func parseMarkdownFile(fsys fs.FS, path string) (*md.Document, error) { … } type APIFeature … var apiFileLineRegexp … // parseAPIFile parses a file in the api format and returns a list of the file's features. // A feature is represented by a single line that looks like // // pkg PKG (BUILD) FEATURE #ISSUE // // where the BUILD and ISSUE may be absent. func parseAPIFile(fsys fs.FS, filename string) ([]APIFeature, error) { … } // GroupAPIFeaturesByFile returns a map of the given features keyed by // the doc filename that they are associated with. // A feature with package P and issue N should be documented in the file // "P/N.md". func GroupAPIFeaturesByFile(fs []APIFeature) (map[string][]APIFeature, error) { … } // CheckAPIFile reads the api file at filename in apiFS, and checks the corresponding // release-note files under docFS. It checks that the files exist and that they have // some minimal content (see [CheckFragment]). // The docRoot argument is the path from the repo or project root to the root of docFS. // It is used only for error messages. func CheckAPIFile(apiFS fs.FS, filename string, docFS fs.FS, docRoot string) error { … } // minorChangesDir returns the unique directory in docFS that corresponds to the // "Minor changes to the standard library" section of the release notes. func minorChangesDir(docFS fs.FS) (string, error) { … } func checkFragmentFile(fsys fs.FS, filename string) error { … }