mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-01 05:39:02 +00:00
LibMarkdown+LibSyntax: Add a Markdown syntax highlighter
It currently supports only headers and code blocks.
This commit is contained in:
parent
416d6ab6c8
commit
cf52542fcf
Notes:
sideshowbarker
2024-07-16 22:16:50 +09:00
Author: https://github.com/sppmacd
Commit: cf52542fcf
Pull-request: https://github.com/SerenityOS/serenity/pull/18535
Reviewed-by: https://github.com/AtkinsSJ ✅
Reviewed-by: https://github.com/MacDue
8 changed files with 156 additions and 4 deletions
23
Userland/Libraries/LibMarkdown/SyntaxHighlighter.h
Normal file
23
Userland/Libraries/LibMarkdown/SyntaxHighlighter.h
Normal file
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* Copyright (c) 2023, Maciej <sppmacd@pm.me>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibSyntax/Highlighter.h>
|
||||
|
||||
namespace Markdown {
|
||||
|
||||
class SyntaxHighlighter : public Syntax::Highlighter {
|
||||
|
||||
virtual Syntax::Language language() const override;
|
||||
virtual Optional<StringView> comment_prefix() const override;
|
||||
virtual Optional<StringView> comment_suffix() const override;
|
||||
virtual void rehighlight(Palette const&) override;
|
||||
virtual Vector<MatchingTokenPair> matching_token_pairs_impl() const override;
|
||||
virtual bool token_types_equal(u64, u64) const override;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue