Coverage Report

Created: 2025-03-04 07:22

/src/serenity/Userland/Libraries/LibMarkdown/List.h
Line
Count
Source
1
/*
2
 * Copyright (c) 2019-2020, Sergey Bugaev <bugaevc@serenityos.org>
3
 * Copyright (c) 2022, the SerenityOS developers.
4
 *
5
 * SPDX-License-Identifier: BSD-2-Clause
6
 */
7
8
#pragma once
9
10
#include <AK/OwnPtr.h>
11
#include <LibMarkdown/Block.h>
12
#include <LibMarkdown/ContainerBlock.h>
13
#include <LibMarkdown/LineIterator.h>
14
15
namespace Markdown {
16
17
class List final : public Block {
18
public:
19
    List(Vector<OwnPtr<ContainerBlock>> items, bool is_ordered, bool is_tight, size_t start_number)
20
88.5k
        : m_items(move(items))
21
88.5k
        , m_is_ordered(is_ordered)
22
88.5k
        , m_is_tight(is_tight)
23
88.5k
        , m_start_number(start_number)
24
88.5k
    {
25
88.5k
    }
26
88.5k
    virtual ~List() override = default;
27
28
    virtual ByteString render_to_html(bool tight = false) const override;
29
    virtual Vector<ByteString> render_lines_for_terminal(size_t view_width = 0) const override;
30
    virtual RecursionDecision walk(Visitor&) const override;
31
32
    static OwnPtr<List> parse(LineIterator& lines);
33
34
private:
35
    Vector<OwnPtr<ContainerBlock>> m_items;
36
    bool m_is_ordered { false };
37
    bool m_is_tight { false };
38
    size_t m_start_number { 1 };
39
};
40
41
}