clang-tools 20.0.0git
Classes | Public Member Functions | List of all members
clang::clangd::markup::Paragraph Class Reference

Represents parts of the markup that can contain strings, like inline code, code block or plain text. More...

#include <Markup.h>

Inheritance diagram for clang::clangd::markup::Paragraph:
Inheritance graph
[legend]

Public Member Functions

void renderMarkdown (llvm::raw_ostream &OS) const override
 
void renderPlainText (llvm::raw_ostream &OS) const override
 
std::unique_ptr< Blockclone () const override
 
ParagraphappendText (llvm::StringRef Text)
 Append plain text to the end of the string.
 
ParagraphappendCode (llvm::StringRef Code, bool Preserve=false)
 Append inline code, this translates to the ` block in markdown.
 
ParagraphappendSpace ()
 Ensure there is space between the surrounding chunks.
 
- Public Member Functions inherited from clang::clangd::markup::Block
virtual void renderMarkdown (llvm::raw_ostream &OS) const =0
 
virtual void renderPlainText (llvm::raw_ostream &OS) const =0
 
virtual std::unique_ptr< Blockclone () const =0
 
std::string asMarkdown () const
 
std::string asPlainText () const
 
virtual bool isRuler () const
 
virtual ~Block ()=default
 

Detailed Description

Represents parts of the markup that can contain strings, like inline code, code block or plain text.

One must introduce different paragraphs to create separate blocks.

Definition at line 43 of file Markup.h.

Member Function Documentation

◆ appendCode()

Paragraph & clang::clangd::markup::Paragraph::appendCode ( llvm::StringRef  Code,
bool  Preserve = false 
)

Append inline code, this translates to the ` block in markdown.

Preserve indicates the code span must be apparent even in plaintext.

Definition at line 436 of file Markup.cpp.

References C.

Referenced by clang::clangd::HoverInfo::present(), and clang::clangd::CodeCompletion::render().

◆ appendSpace()

Paragraph & clang::clangd::markup::Paragraph::appendSpace ( )

Ensure there is space between the surrounding chunks.

Has no effect at the beginning or end of a paragraph.

Definition at line 417 of file Markup.cpp.

Referenced by clang::clangd::HoverInfo::present().

◆ appendText()

Paragraph & clang::clangd::markup::Paragraph::appendText ( llvm::StringRef  Text)

Append plain text to the end of the string.

Definition at line 423 of file Markup.cpp.

References C, and clang::clangd::Text.

Referenced by clang::clangd::HoverInfo::present(), and clang::clangd::CodeCompletion::render().

◆ clone()

std::unique_ptr< Block > clang::clangd::markup::Paragraph::clone ( ) const
overridevirtual

Implements clang::clangd::markup::Block.

Definition at line 367 of file Markup.cpp.

◆ renderMarkdown()

void clang::clangd::markup::Paragraph::renderMarkdown ( llvm::raw_ostream &  OS) const
overridevirtual

Implements clang::clangd::markup::Block.

Definition at line 344 of file Markup.cpp.

References C, and OS.

◆ renderPlainText()

void clang::clangd::markup::Paragraph::renderPlainText ( llvm::raw_ostream &  OS) const
overridevirtual

Implements clang::clangd::markup::Block.

Definition at line 382 of file Markup.cpp.

References C, clang::clangd::markup::chooseMarker(), and OS.


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