summaryrefslogtreecommitdiffstats
path: root/yql/essentials/utils/docs/markdown.h
blob: 6b5477ac253d56329c7c82e9e323b7345894f2e1 (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