12#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_SUPPORT_MARKUP_H
13#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_SUPPORT_MARKUP_H
15#include "llvm/Support/raw_ostream.h"
32 virtual std::unique_ptr<Block>
clone()
const = 0;
36 virtual bool isRuler()
const {
return false; }
47 std::unique_ptr<Block>
clone()
const override;
67 bool Preserve =
false;
72 bool SpaceBefore =
false;
73 bool SpaceAfter =
false;
75 std::vector<Chunk> Chunks;
87 std::unique_ptr<Block>
clone()
const override;
92 std::vector<class Document> Items;
113 void addCodeBlock(std::string Code, std::string Language =
"cpp");
128 std::vector<std::unique_ptr<Block>> Children;
Holds text and knows how to lay it out.
virtual bool isRuler() const
virtual std::unique_ptr< Block > clone() const =0
virtual void renderPlainText(llvm::raw_ostream &OS) const =0
std::string asPlainText() const
std::string asMarkdown() const
virtual void renderMarkdown(llvm::raw_ostream &OS) const =0
Represents a sequence of one or more documents.
void renderPlainText(llvm::raw_ostream &OS) const override
class Document & addItem()
std::unique_ptr< Block > clone() const override
void renderMarkdown(llvm::raw_ostream &OS) const override
A format-agnostic representation for structured text.
Paragraph & addParagraph()
Adds a semantical block that will be separate from others.
std::string asMarkdown() const
Doesn't contain any trailing newlines.
Document & operator=(const Document &)
Paragraph & addHeading(size_t Level)
Heading is a special type of paragraph that will be prepended with Level many '#'s in markdown.
Document & operator=(Document &&)=default
void append(Document Other)
void addCodeBlock(std::string Code, std::string Language="cpp")
Adds a block of code.
BulletList & addBulletList()
std::string asPlainText() const
Doesn't contain any trailing newlines.
Document(const Document &Other)
Document(Document &&)=default
void addRuler()
Inserts a horizontal separator to the document.
Represents parts of the markup that can contain strings, like inline code, code block or plain text.
void renderMarkdown(llvm::raw_ostream &OS) const override
std::unique_ptr< Block > clone() const override
Paragraph & appendText(llvm::StringRef Text)
Append plain text to the end of the string.
void renderPlainText(llvm::raw_ostream &OS) const override
Paragraph & appendSpace()
Ensure there is space between the surrounding chunks.
Paragraph & appendCode(llvm::StringRef Code, bool Preserve=false)
Append inline code, this translates to the ` block in markdown.
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//