MCPcopy Create free account
hub / github.com/campoy/embedmd / parse

Method parse

embedmd/parser.go:101–117  ·  view source on GitHub ↗
(out io.Writer, s textScanner, run commandRunner)

Source from the content-addressed store, hash-verified

99type codeParser struct{ print bool }
100
101func (c codeParser) parse(out io.Writer, s textScanner, run commandRunner) (state, error) {
102 if c.print {
103 fmt.Fprintln(out, s.Text())
104 }
105 if !s.Scan() {
106 return nil, fmt.Errorf("unbalanced code section")
107 }
108 if !strings.HasPrefix(s.Text(), "```") {
109 return c.parse, nil
110 }
111
112 // print the end of the code section if needed and go back to parsing text.
113 if c.print {
114 fmt.Fprintln(out, s.Text())
115 }
116 return parsingText, nil
117}

Callers

nothing calls this directly

Calls 2

TextMethod · 0.80
ScanMethod · 0.65

Tested by

no test coverage detected