| 92 | } |
| 93 | |
| 94 | func loadMarkdownSections() ([][]byte, error) { |
| 95 | log.Printf("Read the md-file-single: %s", inMdFileSingle) |
| 96 | mdFile, err := os.ReadFile(inMdFileSingle) |
| 97 | if err != nil { |
| 98 | return nil, xerrors.Errorf("can't read the md-file-single: %w", err) |
| 99 | } |
| 100 | log.Printf("Read %dB", len(mdFile)) |
| 101 | |
| 102 | sections := bytes.Split(mdFile, sectionSeparator) |
| 103 | if len(sections) < 2 { |
| 104 | return nil, xerrors.Errorf("At least 1 section is expected: %w", err) |
| 105 | } |
| 106 | sections = sections[1:] // Skip the first element which is the empty byte array |
| 107 | log.Printf("Loaded %d sections", len(sections)) |
| 108 | return sections, nil |
| 109 | } |
| 110 | |
| 111 | func prepareDocsDirectory() error { |
| 112 | log.Println("Prepare docs directory") |