summaryrefslogtreecommitdiffstats
path: root/yql/essentials/utils/docs/markdown.h
blob: ebc9707f52af18cc0e8bce6f9b770061ad9b3b89 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#pragma once

#include <util/generic/string.h>
#include <util/generic/hash.h>
#include <util/generic/maybe.h>
#include <util/stream/input.h>

namespace NYql::NDocs {

struct TMarkdownHeader {
    TString Content;
    TMaybe<TString> Anchor;
};

struct TMarkdownSection {
    TMarkdownHeader Header;
    TString Body;
};

struct TMarkdownPage {
    TString Text;
    THashMap<TString, TMarkdownSection> SectionsByAnchor;
};

using TMarkdownCallback = std::function<void(TMarkdownSection&&)>;

TMarkdownPage ParseMarkdownPage(TString markdown);

} // namespace NYql::NDocs