2021-10-23 14:12:27 +02:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2021, Ben Wiederhake <BenWiederhake.GitHub@gmx.de>
|
2022-03-04 13:21:26 -07:00
|
|
|
* Copyright (c) 2022, the SerenityOS developers.
|
2021-10-23 14:12:27 +02:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2023-12-16 17:49:34 +03:30
|
|
|
#include <AK/ByteString.h>
|
2021-10-23 14:12:27 +02:00
|
|
|
#include <AK/OwnPtr.h>
|
|
|
|
|
#include <LibMarkdown/Block.h>
|
|
|
|
|
#include <LibMarkdown/LineIterator.h>
|
|
|
|
|
|
|
|
|
|
namespace Markdown {
|
|
|
|
|
|
|
|
|
|
class CommentBlock final : public Block {
|
|
|
|
|
public:
|
2023-12-16 17:49:34 +03:30
|
|
|
CommentBlock(ByteString const& comment)
|
2021-10-23 14:12:27 +02:00
|
|
|
: m_comment(comment)
|
|
|
|
|
{
|
|
|
|
|
}
|
2022-03-04 13:21:26 -07:00
|
|
|
virtual ~CommentBlock() override = default;
|
2021-10-23 14:12:27 +02:00
|
|
|
|
2023-12-16 17:49:34 +03:30
|
|
|
virtual ByteString render_to_html(bool tight = false) const override;
|
|
|
|
|
virtual Vector<ByteString> render_lines_for_terminal(size_t view_width = 0) const override;
|
2021-10-23 14:12:27 +02:00
|
|
|
virtual RecursionDecision walk(Visitor&) const override;
|
|
|
|
|
static OwnPtr<CommentBlock> parse(LineIterator& lines);
|
|
|
|
|
|
|
|
|
|
private:
|
2023-12-16 17:49:34 +03:30
|
|
|
ByteString m_comment;
|
2021-10-23 14:12:27 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|