clang-tools  14.0.0git
Public Member Functions | List of all members
clang::clangd::markup::Document Class Reference

A format-agnostic representation for structured text. More...

#include <Markup.h>

Public Member Functions

 Document ()=default
 
 Document (const Document &Other)
 
Documentoperator= (const Document &)
 
 Document (Document &&)=default
 
Documentoperator= (Document &&)=default
 
void append (Document Other)
 
ParagraphaddParagraph ()
 Adds a semantical block that will be separate from others. More...
 
void addRuler ()
 Inserts a horizontal separator to the document. More...
 
void addCodeBlock (std::string Code, std::string Language="cpp")
 Adds a block of code. More...
 
ParagraphaddHeading (size_t Level)
 Heading is a special type of paragraph that will be prepended with Level many '#'s in markdown. More...
 
BulletListaddBulletList ()
 
std::string asMarkdown () const
 Doesn't contain any trailing newlines. More...
 
std::string asPlainText () const
 Doesn't contain any trailing newlines. More...
 

Detailed Description

A format-agnostic representation for structured text.

Allows rendering into markdown and plaintext.

Definition at line 94 of file Markup.h.

Constructor & Destructor Documentation

◆ Document() [1/3]

clang::clangd::markup::Document::Document ( )
default

◆ Document() [2/3]

clang::clangd::markup::Document::Document ( const Document Other)
inline

Definition at line 97 of file Markup.h.

◆ Document() [3/3]

clang::clangd::markup::Document::Document ( Document &&  )
default

Member Function Documentation

◆ addBulletList()

BulletList & clang::clangd::markup::Document::addBulletList ( )

Definition at line 492 of file Markup.cpp.

References Children.

◆ addCodeBlock()

void clang::clangd::markup::Document::addCodeBlock ( std::string  Code,
std::string  Language = "cpp" 
)

Adds a block of code.

This translates to a ``` block in markdown. In plain text representation, the code block will be surrounded by newlines.

Definition at line 479 of file Markup.cpp.

◆ addHeading()

Paragraph & clang::clangd::markup::Document::addHeading ( size_t  Level)

Heading is a special type of paragraph that will be prepended with Level many '#'s in markdown.

Definition at line 497 of file Markup.cpp.

◆ addParagraph()

Paragraph & clang::clangd::markup::Document::addParagraph ( )

Adds a semantical block that will be separate from others.

Definition at line 472 of file Markup.cpp.

References Children.

◆ addRuler()

void clang::clangd::markup::Document::addRuler ( )

Inserts a horizontal separator to the document.

Definition at line 477 of file Markup.cpp.

References Children.

◆ append()

void clang::clangd::markup::Document::append ( Document  Other)

Definition at line 467 of file Markup.cpp.

References Children.

◆ asMarkdown()

std::string clang::clangd::markup::Document::asMarkdown ( ) const

Doesn't contain any trailing newlines.

We try to make the markdown human-readable, e.g. avoid extra escaping. At least one client (coc.nvim) displays the markdown verbatim!

Definition at line 484 of file Markup.cpp.

References Children, and clang::clangd::markup::Block::renderMarkdown().

◆ asPlainText()

std::string clang::clangd::markup::Document::asPlainText ( ) const

Doesn't contain any trailing newlines.

Definition at line 488 of file Markup.cpp.

References Children, and clang::clangd::markup::Block::renderPlainText().

◆ operator=() [1/2]

Document & clang::clangd::markup::Document::operator= ( const Document Other)

Definition at line 460 of file Markup.cpp.

References C, and Children.

◆ operator=() [2/2]

Document& clang::clangd::markup::Document::operator= ( Document &&  )
default

The documentation for this class was generated from the following files: