MD

MD Namespace Reference

Namespaces

namespace  details
 

Classes

class  Anchor
 
class  Block
 
class  Blockquote
 
class  Code
 
class  Document
 
class  Footnote
 
class  FootnoteRef
 
class  Heading
 
class  HorizontalLine
 
class  Image
 
class  InternalStringT
 
class  Item
 
class  ItemWithOpts
 
class  LineBreak
 
class  Link
 
class  LinkBase
 
class  List
 
class  ListItem
 
class  Math
 
struct  MdBlock
 
struct  MdLineData
 
class  PageBreak
 
class  Paragraph
 
class  Parser
 
class  PosCache
 
struct  QStringTrait
 
class  RawHtml
 
struct  RawHtmlBlock
 
class  StringListStream
 
class  StyleDelim
 
class  Table
 
class  TableCell
 
class  TableRow
 
class  Text
 
struct  TextParsingOpts
 
class  TextStream
 
class  TextStream< QStringTrait >
 
class  TextStream< UnicodeStringTrait >
 
class  UnicodeChar
 
class  UnicodeString
 
struct  UnicodeStringTrait
 
struct  UnprotectedDocsMethods
 
class  UrlUri
 
class  Visitor
 
class  WithPosition
 

Typedefs

template<class Trait>
using ItemFunctor = std::function<void(Item<Trait> *)>
 
template<class Trait>
using TextPluginFunc
 
template<class Trait>
using TextPluginsMap
 

Enumerations

enum class  ItemType : int {
  Heading = 0 , Text , Paragraph , LineBreak ,
  Blockquote , ListItem , List , Link ,
  Image , Code , TableCell , TableRow ,
  Table , FootnoteRef , Footnote , Document ,
  PageBreak , Anchor , HorizontalLine , RawHtml ,
  Math , UserDefined = 255
}
 
enum class  OptimizeParagraphType { Full , Semi , FullWithoutRawData , SemiWithoutRawData }
 
enum class  Style {
  Italic1 , Italic2 , Bold1 , Bold2 ,
  Strikethrough , Unknown
}
 
enum  TextOption { TextWithoutFormat = 0 , BoldText = 1 , ItalicText = 2 , StrikethroughText = 4 }
 
enum  TextPlugin : int { UnknownPluginID = 0 , GitHubAutoLinkPluginID = 1 , UserDefinedPluginID = 255 }
 

Functions

template<class Trait>
void appendCloseStyle (TextParsingOpts< Trait > &po, const StyleDelim &s)
 
template<class Trait>
void applyStyles (int &opts, std::vector< typename TextParsingOpts< Trait >::StyleInfo > &styles)
 
template<class Trait>
std::pair< long long int, long long int > calculateIndent (const typename Trait::String &s, long long int p)
 
template<class Trait>
bool checkForEndHtmlComments (const typename Trait::String &line, long long int pos)
 
template<class Trait>
void checkForHtmlComments (const typename Trait::InternalString &line, StringListStream< Trait > &stream, MdLineData::CommentDataMap &res)
 
template<class Trait>
void checkForTableInParagraph (TextParsingOpts< Trait > &po, long long int lastLine)
 
template<class Trait>
void checkForTextPlugins (std::shared_ptr< Paragraph< Trait > > p, TextParsingOpts< Trait > &po, const TextPluginsMap< Trait > &textPlugins, bool inLink)
 
template<class Trait>
void closeStyle (std::vector< typename TextParsingOpts< Trait >::StyleInfo > &styles, Style s)
 
template<class Trait>
std::shared_ptr< Text< Trait > > concatenateText (typename Block< Trait >::Items::const_iterator it, typename Block< Trait >::Items::const_iterator last)
 
template<class Trait>
void eatRawHtml (long long int line, long long int pos, long long int toLine, long long int toPos, TextParsingOpts< Trait > &po, bool finish, int htmlRule, bool onLine, bool continueEating=false)
 
template<class Trait>
long long int emptyLinesBeforeCount (typename MdBlock< Trait >::Data::iterator begin, typename MdBlock< Trait >::Data::iterator it)
 
template<class Trait>
WithPosition findAndRemoveClosingSequence (typename Trait::InternalString &s)
 
template<class Trait>
std::pair< typename Trait::String, WithPositionfindAndRemoveHeaderLabel (typename Trait::InternalString &s)
 
template<class Trait>
void forEach (const typename Trait::template Vector< ItemType > &types, std::shared_ptr< Document< Trait > > doc, ItemFunctor< Trait > func, unsigned int maxNestingLevel=0)
 
template<class Trait>
void githubAutolinkPlugin (std::shared_ptr< Paragraph< Trait > > p, TextParsingOpts< Trait > &po, const typename Trait::StringList &)
 
bool indentInList (const std::vector< long long int > *indents, long long int indent, bool codeIndentedBySpaces)
 
template<class Trait>
void initLastItemWithOpts (TextParsingOpts< Trait > &po, std::shared_ptr< ItemWithOpts< Trait > > item)
 
template<class Trait>
bool isCodeFences (const typename Trait::String &s, bool closing=false)
 
template<class Trait>
bool isColumnAlignment (const typename Trait::String &s)
 
template<class Trait>
bool isEmail (const typename Trait::String &url)
 
template<class Trait>
bool isFootnote (const typename Trait::String &s)
 
template<class Trait>
bool isGitHubAutolink (const typename Trait::String &url)
 
template<>
bool isGitHubAutolink< QStringTrait > (const QString &url)
 
template<>
bool isGitHubAutolink< UnicodeStringTrait > (const UnicodeString &url)
 
template<class Trait>
bool isH (const typename Trait::String &s, const typename Trait::Char &c)
 
template<class Trait>
bool isH1 (const typename Trait::String &s)
 
template<class Trait>
bool isH2 (const typename Trait::String &s)
 
template<class Trait>
bool isHorizontalLine (const typename Trait::String &s)
 
template<class Trait>
bool isHtmlComment (const typename Trait::String &s)
 
template<class Trait>
std::tuple< bool, long long int, long long int, bool, typename Trait::String > isHtmlTag (long long int line, long long int pos, TextParsingOpts< Trait > &po, int rule)
 
template<class Trait>
bool isLineBreak (const typename Trait::String &s)
 
template<class Trait>
bool isListItemAndNotNested (const typename Trait::String &s, long long int indent)
 
bool isMult3 (long long int i1, long long int i2)
 
template<class Trait>
bool isOnlyHtmlTagsAfterOrClosedRule1 (long long int line, long long int pos, TextParsingOpts< Trait > &po, int rule)
 
template<class Trait>
bool isOrderedList (const typename Trait::String &s, int *num=nullptr, int *len=nullptr, typename Trait::Char *delim=nullptr, bool *isFirstLineEmpty=nullptr)
 
bool isSemiOptimization (OptimizeParagraphType t)
 
template<class Trait>
bool isSetextHeadingBetween (const TextParsingOpts< Trait > &po, long long int startLine, long long int endLine)
 
template<class Trait>
bool isStartOfCode (const typename Trait::String &str, typename Trait::String *syntax=nullptr, WithPosition *delim=nullptr, WithPosition *syntaxPos=nullptr)
 
template<class Trait>
int isTableAlignment (const typename Trait::String &s)
 
template<class Trait>
int isTableHeader (const typename Trait::String &s)
 
template<class Trait>
bool isValidUrl (const typename Trait::String &url)
 
template<>
bool isValidUrl< QStringTrait > (const QString &url)
 
template<>
bool isValidUrl< UnicodeStringTrait > (const UnicodeString &url)
 
bool isWithoutRawDataOptimization (OptimizeParagraphType t)
 
template<class String>
long long int lastNonSpacePos (const String &line)
 
template<class Trait>
long long int lastVirginPositionInParagraph (Item< Trait > *item)
 
template<class Trait>
long long int lineBreakLength (const typename Trait::String &s)
 
template<class Trait>
std::tuple< bool, long long int, typename Trait::Char, bool > listItemData (const typename Trait::String &s, bool wasText)
 
long long int listLevel (const std::vector< long long int > &indents, long long int pos)
 
template<class Trait>
std::pair< long long int, long long int > localPosFromVirgin (const MdBlock< Trait > &fr, long long int virginColumn, long long int virginLine)
 
template<class Trait>
void makeHeading (std::shared_ptr< Block< Trait > > parent, std::shared_ptr< Document< Trait > > doc, std::shared_ptr< Paragraph< Trait > > p, long long int lastColumn, long long int lastLine, int level, const typename Trait::String &workingPath, const typename Trait::String &fileName, bool collectRefLinks, const WithPosition &delim, TextParsingOpts< Trait > &po)
 
template<class Trait>
void makeHorLine (const typename MdBlock< Trait >::Line &line, std::shared_ptr< Block< Trait > > parent)
 
template<class Trait>
std::shared_ptr< Paragraph< Trait > > makeParagraph (typename Block< Trait >::Items::const_iterator first, typename Block< Trait >::Items::const_iterator last)
 
template<class Trait>
void makeText (long long int lastLine, long long int lastPos, TextParsingOpts< Trait > &po)
 
template<class Trait>
void makeTextObject (const typename Trait::String &text, TextParsingOpts< Trait > &po, long long int startPos, long long int startLine, long long int endPos, long long int endLine, bool doRemoveSpacesAtEnd=false)
 
template<class Trait>
void makeTextObjectWithLineBreak (const typename Trait::String &text, TextParsingOpts< Trait > &po, long long int startPos, long long int startLine, long long int endPos, long long int endLine)
 
template<class Trait>
std::pair< long long int, long long int > nextPosition (const MdBlock< Trait > &fr, long long int pos, long long int line)
 
void normalizePos (long long int &pos, long long int &line, long long int length, long long int linesCount)
 
bool operator== (const StyleDelim &l, const StyleDelim &r)
 
bool operator== (const WithPosition &l, const WithPosition &r)
 
template<class Trait>
std::shared_ptr< Paragraph< Trait > > optimizeParagraph (std::shared_ptr< Paragraph< Trait > > &p, TextParsingOpts< Trait > &po, OptimizeParagraphType type=OptimizeParagraphType::Full)
 
template<class Trait>
Trait::String paragraphToLabel (Paragraph< Trait > *p)
 
template<class Trait>
long long int posOfListItem (const typename Trait::String &s, bool ordered)
 
template<class Trait>
Trait::InternalString prepareTableData (typename Trait::InternalString s)
 
template<class Trait>
std::pair< long long int, long long int > prevPosition (const MdBlock< Trait > &fr, long long int pos, long long int line)
 
template<class Trait>
long long int processGitHubAutolinkExtension (std::shared_ptr< Paragraph< Trait > > p, TextParsingOpts< Trait > &po, long long int idx)
 
template<class Trait>
Trait::String readEscapedSequence (long long int i, const typename Trait::String &str, long long int *endPos=nullptr)
 
template<class Trait>
std::pair< bool, bool > readHtmlAttr (long long int &l, long long int &p, const typename MdBlock< Trait >::Data &fr, bool checkForSpace)
 
template<class Trait>
std::pair< bool, bool > readHtmlAttrValue (long long int &l, long long int &p, const typename MdBlock< Trait >::Data &fr)
 
template<class Trait>
std::tuple< long long int, long long int, bool, typename Trait::String, long long int > readLinkDestination (long long int line, long long int pos, const TextParsingOpts< Trait > &po, WithPosition *urlPos=nullptr)
 
template<class Trait>
std::tuple< long long int, long long int, bool, typename Trait::String, long long int > readLinkTitle (long long int line, long long int pos, const TextParsingOpts< Trait > &po)
 
template<class Trait>
std::pair< bool, bool > readUnquotedHtmlAttrValue (long long int &l, long long int &p, const typename MdBlock< Trait >::Data &fr)
 
template<class String, class Trait>
String removeBackslashes (const String &s)
 
template<class Trait>
MdBlock< Trait >::Data removeBackslashes (const typename MdBlock< Trait >::Data &d)
 
template<class Trait>
Trait::String removeLineBreak (const typename Trait::String &s)
 
template<class String>
void removeSpacesAtEnd (String &s)
 
template<class Trait>
Trait::String replaceEntity (const typename Trait::String &s)
 
template<class Trait>
void replaceTabs (typename Trait::InternalString &s)
 
template<class Trait>
void resetHtmlTag (RawHtmlBlock< Trait > &html, TextParsingOpts< Trait > *po=nullptr)
 
template<class Trait>
void resolveLinks (typename Trait::StringList &linksToParse, std::shared_ptr< Document< Trait > > doc)
 
template<class Trait>
void setLastPos (std::shared_ptr< Item< Trait > > item, long long int pos, long long int line)
 
template<class Trait>
long long int skipSpaces (long long int i, const typename Trait::String &line)
 
template<class Trait>
void skipSpacesInHtml (long long int &l, long long int &p, const typename MdBlock< Trait >::Data &fr)
 
template<class Trait>
void skipSpacesUpTo1Line (long long int &line, long long int &pos, const typename MdBlock< Trait >::Data &fr)
 
template<class Trait>
std::shared_ptr< Paragraph< Trait > > splitParagraphsAndFreeHtml (std::shared_ptr< Block< Trait > > parent, std::shared_ptr< Paragraph< Trait > > p, TextParsingOpts< Trait > &po, bool collectRefLinks, bool fullyOptimizeParagraphs=true)
 
template<class Trait>
Trait::StringList splitString (const typename Trait::String &str, const typename Trait::Char &ch)
 
template<>
QStringTrait::StringList splitString< QStringTrait > (const QString &str, const QChar &ch)
 
template<>
UnicodeStringTrait::StringList splitString< UnicodeStringTrait > (const UnicodeString &str, const UnicodeChar &ch)
 
template<class Trait>
std::pair< typename Trait::InternalStringList, std::vector< long long int > > splitTableRow (const typename Trait::InternalString &s)
 
template<class Trait>
Trait::String startSequence (const typename Trait::String &line)
 
template<class Trait>
Trait::String stringToLabel (const typename Trait::String &s)
 
TextOption styleToTextOption (Style s)
 
template<class Trait>
long long int textAtIdx (std::shared_ptr< Paragraph< Trait > > p, size_t idx)
 
template<class Trait, class HtmlVisitor = details::HtmlVisitor<Trait>>
Trait::String toHtml (std::shared_ptr< Document< Trait > > doc, bool wrapInBodyTag=true, const typename Trait::String &hrefForRefBackImage={}, bool wrapInArticle=true)
 
template<class Trait>
void updateLastPosInList (const RawHtmlBlock< Trait > &html)
 
template<class Trait>
Trait::String virginSubstr (const MdBlock< Trait > &fr, const WithPosition &virginPos)
 

Variables

template<class Trait>
static const Trait::String s_canBeEscaped
 
template<class Trait>
static const std::map< typename Trait::String, const char16_t * > s_entityMap
 
static const char * s_startComment = "<!--"
 

Typedef Documentation

◆ ItemFunctor

template<class Trait>
using MD::ItemFunctor = std::function<void(Item<Trait> *)>

Function type for algorithms.

Definition at line 21 of file algo.h.

◆ TextPluginFunc

template<class Trait>
using MD::TextPluginFunc
Initial value:
std::function<void(std::shared_ptr<Paragraph<Trait>>,
const typename Trait::StringList &)>
Paragraph.
Definition doc.h:679
Internal structure for auxiliary options for parser.
Definition parser.h:926

Functor type for text plugin.

Definition at line 906 of file parser.h.

◆ TextPluginsMap

template<class Trait>
using MD::TextPluginsMap
Initial value:
std::map<int, std::tuple<TextPluginFunc<Trait>,
bool,
typename Trait::StringList>>

Type of the map of text plugins.

Definition at line 916 of file parser.h.

Enumeration Type Documentation

◆ ItemType

enum class MD::ItemType : int
strong

Enumeration of item types.

Enumerator
Heading 

Heading.

Text 

Text.

Paragraph 

Paragraph.

LineBreak 

Line break.

Blockquote 

Blockquote.

ListItem 

List item.

List 

List.

Link 

Link.

Image 

Image.

Code 

Code.

TableCell 

Table cell.

TableRow 

Table row.

Table 

Table.

FootnoteRef 

Footnote ref.

Footnote 

Footnote.

Document 

Document.

PageBreak 

Page break.

Anchor 

Anchor.

HorizontalLine 

Horizontal line.

RawHtml 

Raw HTML.

Math 

Math expression.

UserDefined 

Start item for user-defined types.

Definition at line 23 of file doc.h.

◆ OptimizeParagraphType

enum class MD::OptimizeParagraphType
strong

Type of the paragraph's optimization.

Enumerator
Full 

Full optimization.

Semi 

Semi optimization, optimization won't concatenate text items if style delimiters will be in the middle.

FullWithoutRawData 

Full optimization, but raw text data won't be concatenated (will be untouched).

SemiWithoutRawData 

Semi optimization, but raw text data won't be concatenated (will be untouched).

Definition at line 830 of file parser.h.

◆ Style

enum class MD::Style
strong

Emphasis type.

Enumerator
Italic1 

"*"

Italic2 

"_"

Bold1 

"**"

Bold2 

"__"

Strikethrough 

"~"

Unknown 

Unknown.

Definition at line 861 of file parser.h.

◆ TextOption

Text option.

Enumerator
TextWithoutFormat 

No format.

BoldText 

Bold text.

ItalicText 

Italic text.

StrikethroughText 

Strikethrough.

Definition at line 199 of file doc.h.

◆ TextPlugin

enum MD::TextPlugin : int

ID of text plugin.

Enumerator
UnknownPluginID 

Unknown plugin.

GitHubAutoLinkPluginID 

GitHub's autolinks plugin.

UserDefinedPluginID 

First user defined plugin ID.

Definition at line 847 of file parser.h.

Function Documentation

◆ appendCloseStyle()

template<class Trait>
void MD::appendCloseStyle ( TextParsingOpts< Trait > & po,
const StyleDelim & s )
inline

Append close style.

Definition at line 7750 of file parser.h.

◆ applyStyles()

template<class Trait>
void MD::applyStyles ( int & opts,
std::vector< typename TextParsingOpts< Trait >::StyleInfo > & styles )
inline

Apply styles.

Definition at line 7316 of file parser.h.

◆ calculateIndent()

template<class Trait>
std::pair< long long int, long long int > MD::calculateIndent ( const typename Trait::String & s,
long long int p )
inline
Returns
Indent.

Definition at line 9045 of file parser.h.

◆ checkForEndHtmlComments()

template<class Trait>
bool MD::checkForEndHtmlComments ( const typename Trait::String & line,
long long int pos )
inline
Returns
Is HTML comment closed?

Definition at line 2352 of file parser.h.

◆ checkForHtmlComments()

template<class Trait>
void MD::checkForHtmlComments ( const typename Trait::InternalString & line,
StringListStream< Trait > & stream,
MdLineData::CommentDataMap & res )
inline

Collect information about HTML comments.

Definition at line 2367 of file parser.h.

◆ checkForTableInParagraph()

template<class Trait>
void MD::checkForTableInParagraph ( TextParsingOpts< Trait > & po,
long long int lastLine )
inline

Check for table in paragraph.

Definition at line 4620 of file parser.h.

◆ checkForTextPlugins()

template<class Trait>
void MD::checkForTextPlugins ( std::shared_ptr< Paragraph< Trait > > p,
TextParsingOpts< Trait > & po,
const TextPluginsMap< Trait > & textPlugins,
bool inLink )
inline

Process text plugins.

Definition at line 8475 of file parser.h.

◆ closeStyle()

template<class Trait>
void MD::closeStyle ( std::vector< typename TextParsingOpts< Trait >::StyleInfo > & styles,
Style s )
inline

Close style.

Definition at line 7301 of file parser.h.

◆ concatenateText()

template<class Trait>
std::shared_ptr< Text< Trait > > MD::concatenateText ( typename Block< Trait >::Items::const_iterator it,
typename Block< Trait >::Items::const_iterator last )
inline

Concatenate texts in block.

Definition at line 7989 of file parser.h.

◆ eatRawHtml()

template<class Trait>
void MD::eatRawHtml ( long long int line,
long long int pos,
long long int toLine,
long long int toPos,
TextParsingOpts< Trait > & po,
bool finish,
int htmlRule,
bool onLine,
bool continueEating = false )
inline

Read HTML data.

Definition at line 5241 of file parser.h.

◆ emptyLinesBeforeCount()

template<class Trait>
long long int MD::emptyLinesBeforeCount ( typename MdBlock< Trait >::Data::iterator begin,
typename MdBlock< Trait >::Data::iterator it )
inline

Definition at line 251 of file parser.h.

◆ findAndRemoveClosingSequence()

template<class Trait>
WithPosition MD::findAndRemoveClosingSequence ( typename Trait::InternalString & s)
inline

Find and remove closing sequence of "#" in heading.

Definition at line 3770 of file parser.h.

◆ findAndRemoveHeaderLabel()

template<class Trait>
std::pair< typename Trait::String, WithPosition > MD::findAndRemoveHeaderLabel ( typename Trait::InternalString & s)
inline

Find and remove heading label.

Definition at line 3664 of file parser.h.

◆ forEach()

template<class Trait>
void MD::forEach ( const typename Trait::template Vector< ItemType > & types,
std::shared_ptr< Document< Trait > > doc,
ItemFunctor< Trait > func,
unsigned int maxNestingLevel = 0 )
inline

Calls function for each item in the document with the given type.

Parameters
typesVector of item's types to be processed.
docDocument.
funcFunctor object.
maxNestingLevelMaximun nesting level. 0 means infinity, 1 - only top level items...

Definition at line 375 of file algo.h.

◆ githubAutolinkPlugin()

template<class Trait>
void MD::githubAutolinkPlugin ( std::shared_ptr< Paragraph< Trait > > p,
TextParsingOpts< Trait > & po,
const typename Trait::StringList &  )
inline

GitHub autolinks plugin.

Definition at line 1411 of file parser.h.

◆ indentInList()

bool MD::indentInList ( const std::vector< long long int > * indents,
long long int indent,
bool codeIndentedBySpaces )
inline
Returns
Is indent indent belongs to list with previous indents indents.

Definition at line 51 of file parser.h.

◆ initLastItemWithOpts()

template<class Trait>
void MD::initLastItemWithOpts ( TextParsingOpts< Trait > & po,
std::shared_ptr< ItemWithOpts< Trait > > item )
inline

Initialize item with style information and set it as last item.

Definition at line 4506 of file parser.h.

◆ isCodeFences()

template<class Trait>
bool MD::isCodeFences ( const typename Trait::String & s,
bool closing = false )
inline
Returns
Is string a code fences?

Definition at line 377 of file parser.h.

◆ isColumnAlignment()

template<class Trait>
bool MD::isColumnAlignment ( const typename Trait::String & s)
inline
Returns
Is string a column alignment?

Definition at line 613 of file parser.h.

◆ isEmail()

template<class Trait>
bool MD::isEmail ( const typename Trait::String & url)
inline
Returns
Is the given string a valid email?

Definition at line 1130 of file parser.h.

◆ isFootnote()

template<class Trait>
bool MD::isFootnote ( const typename Trait::String & s)
inline
Returns
Is string a footnote?

Definition at line 337 of file parser.h.

◆ isGitHubAutolink()

template<class Trait>
bool MD::isGitHubAutolink ( const typename Trait::String & url)
inline
Returns
Is the given string a GitHub autolink?

◆ isGitHubAutolink< QStringTrait >()

template<>
bool MD::isGitHubAutolink< QStringTrait > ( const QString & url)
inline

Definition at line 1238 of file parser.h.

◆ isGitHubAutolink< UnicodeStringTrait >()

template<>
bool MD::isGitHubAutolink< UnicodeStringTrait > ( const UnicodeString & url)
inline

Definition at line 1263 of file parser.h.

◆ isH()

template<class Trait>
bool MD::isH ( const typename Trait::String & s,
const typename Trait::Char & c )
inline
Returns
Is the given string a heading's service sequence?

Definition at line 4131 of file parser.h.

◆ isH1()

template<class Trait>
bool MD::isH1 ( const typename Trait::String & s)
inline
Returns
Is the given string a heading's service sequence of level 1?

Definition at line 4164 of file parser.h.

◆ isH2()

template<class Trait>
bool MD::isH2 ( const typename Trait::String & s)
inline
Returns
Is the given string a heading's service sequence of level 2?

Definition at line 4172 of file parser.h.

◆ isHorizontalLine()

template<class Trait>
bool MD::isHorizontalLine ( const typename Trait::String & s)
inline
Returns
Is string a horizontal line?

Definition at line 570 of file parser.h.

◆ isHtmlComment()

template<class Trait>
bool MD::isHtmlComment ( const typename Trait::String & s)
inline
Returns
Is given string a HTML comment.

Definition at line 702 of file parser.h.

◆ isHtmlTag()

template<class Trait>
std::tuple< bool, long long int, long long int, bool, typename Trait::String > MD::isHtmlTag ( long long int line,
long long int pos,
TextParsingOpts< Trait > & po,
int rule )
inline
Returns
Is HTML tag at the given position?

Definition at line 5035 of file parser.h.

◆ isLineBreak()

template<class Trait>
bool MD::isLineBreak ( const typename Trait::String & s)
inline
Returns
Is the given string a line break.

Definition at line 4470 of file parser.h.

◆ isListItemAndNotNested()

template<class Trait>
bool MD::isListItemAndNotNested ( const typename Trait::String & s,
long long int indent )
inline
Returns
Is the given string a new list item.

Definition at line 9011 of file parser.h.

◆ isMult3()

bool MD::isMult3 ( long long int i1,
long long int i2 )
inline

Definition at line 7439 of file parser.h.

◆ isOnlyHtmlTagsAfterOrClosedRule1()

template<class Trait>
bool MD::isOnlyHtmlTagsAfterOrClosedRule1 ( long long int line,
long long int pos,
TextParsingOpts< Trait > & po,
int rule )
inline
Returns
Is after the given position only HTML tags?

Definition at line 4963 of file parser.h.

◆ isOrderedList()

template<class Trait>
bool MD::isOrderedList ( const typename Trait::String & s,
int * num = nullptr,
int * len = nullptr,
typename Trait::Char * delim = nullptr,
bool * isFirstLineEmpty = nullptr )
inline
Returns
Is string an ordered list.

Definition at line 134 of file parser.h.

◆ isSemiOptimization()

bool MD::isSemiOptimization ( OptimizeParagraphType t)
inline
Returns
Is optimization type a semi one.

Definition at line 8029 of file parser.h.

◆ isSetextHeadingBetween()

template<class Trait>
bool MD::isSetextHeadingBetween ( const TextParsingOpts< Trait > & po,
long long int startLine,
long long int endLine )
inline
Returns
Is setext heading in the lines?

Definition at line 5016 of file parser.h.

◆ isStartOfCode()

template<class Trait>
bool MD::isStartOfCode ( const typename Trait::String & str,
typename Trait::String * syntax = nullptr,
WithPosition * delim = nullptr,
WithPosition * syntaxPos = nullptr )
inline
Returns
Is string a start of code?

Definition at line 503 of file parser.h.

◆ isTableAlignment()

template<class Trait>
int MD::isTableAlignment ( const typename Trait::String & s)
inline
Returns
Number of columns?

Definition at line 686 of file parser.h.

◆ isTableHeader()

template<class Trait>
int MD::isTableHeader ( const typename Trait::String & s)
inline
Returns
Number of columns in table, if the given string is a table header.

Definition at line 3599 of file parser.h.

◆ isValidUrl()

template<class Trait>
bool MD::isValidUrl ( const typename Trait::String & url)
inline
Returns
Is the fiven string a valid URL?

◆ isValidUrl< QStringTrait >()

template<>
bool MD::isValidUrl< QStringTrait > ( const QString & url)
inline

Definition at line 1229 of file parser.h.

◆ isValidUrl< UnicodeStringTrait >()

template<>
bool MD::isValidUrl< UnicodeStringTrait > ( const UnicodeString & url)
inline

Definition at line 1254 of file parser.h.

◆ isWithoutRawDataOptimization()

bool MD::isWithoutRawDataOptimization ( OptimizeParagraphType t)
inline
Returns
Is optimization type without raw data optimization?

Definition at line 8043 of file parser.h.

◆ lastNonSpacePos()

template<class String>
long long int MD::lastNonSpacePos ( const String & line)
inline
Returns
Last non-space character position.

Definition at line 85 of file parser.h.

◆ lastVirginPositionInParagraph()

template<class Trait>
long long int MD::lastVirginPositionInParagraph ( Item< Trait > * item)
inline
Returns
Last virgin position of the item.

Definition at line 8228 of file parser.h.

◆ lineBreakLength()

template<class Trait>
long long int MD::lineBreakLength ( const typename Trait::String & s)
inline
Returns
Length of line break.

Definition at line 4486 of file parser.h.

◆ listItemData()

template<class Trait>
std::tuple< bool, long long int, typename Trait::Char, bool > MD::listItemData ( const typename Trait::String & s,
bool wasText )
inline
Returns
List item data.

Definition at line 9054 of file parser.h.

◆ listLevel()

long long int MD::listLevel ( const std::vector< long long int > & indents,
long long int pos )
inline
Returns
Level in indents for the given position.

Definition at line 3373 of file parser.h.

◆ localPosFromVirgin()

template<class Trait>
std::pair< long long int, long long int > MD::localPosFromVirgin ( const MdBlock< Trait > & fr,
long long int virginColumn,
long long int virginLine )
inline
Returns
Local position ( { column, line } ) in fragment for given virgin position if exists.
{ -1, -1 } if there is no given position.

Definition at line 1093 of file parser.h.

◆ makeHeading()

template<class Trait>
void MD::makeHeading ( std::shared_ptr< Block< Trait > > parent,
std::shared_ptr< Document< Trait > > doc,
std::shared_ptr< Paragraph< Trait > > p,
long long int lastColumn,
long long int lastLine,
int level,
const typename Trait::String & workingPath,
const typename Trait::String & fileName,
bool collectRefLinks,
const WithPosition & delim,
TextParsingOpts< Trait > & po )
inline

Make heading.

Definition at line 8268 of file parser.h.

◆ makeHorLine()

template<class Trait>
void MD::makeHorLine ( const typename MdBlock< Trait >::Line & line,
std::shared_ptr< Block< Trait > > parent )
inline

Make horizontal line.

Definition at line 8493 of file parser.h.

◆ makeParagraph()

template<class Trait>
std::shared_ptr< Paragraph< Trait > > MD::makeParagraph ( typename Block< Trait >::Items::const_iterator first,
typename Block< Trait >::Items::const_iterator last )
inline

Make Paragraph.

Definition at line 8152 of file parser.h.

◆ makeText()

template<class Trait>
void MD::makeText ( long long int lastLine,
long long int lastPos,
TextParsingOpts< Trait > & po )
inline

Make text item.

Definition at line 4650 of file parser.h.

◆ makeTextObject()

template<class Trait>
void MD::makeTextObject ( const typename Trait::String & text,
TextParsingOpts< Trait > & po,
long long int startPos,
long long int startLine,
long long int endPos,
long long int endLine,
bool doRemoveSpacesAtEnd = false )
inline

Make text item.

Definition at line 4517 of file parser.h.

◆ makeTextObjectWithLineBreak()

template<class Trait>
void MD::makeTextObjectWithLineBreak ( const typename Trait::String & text,
TextParsingOpts< Trait > & po,
long long int startPos,
long long int startLine,
long long int endPos,
long long int endLine )
inline

Make text item with line break.

Definition at line 4587 of file parser.h.

◆ nextPosition()

template<class Trait>
std::pair< long long int, long long int > MD::nextPosition ( const MdBlock< Trait > & fr,
long long int pos,
long long int line )
inline
Returns
Next position in the block.

Definition at line 4203 of file parser.h.

◆ normalizePos()

void MD::normalizePos ( long long int & pos,
long long int & line,
long long int length,
long long int linesCount )
inline

Normalize position.

Definition at line 8138 of file parser.h.

◆ operator==() [1/2]

bool MD::operator== ( const StyleDelim & l,
const StyleDelim & r )
inline

Definition at line 246 of file doc.h.

◆ operator==() [2/2]

bool MD::operator== ( const WithPosition & l,
const WithPosition & r )
inline

Definition at line 159 of file doc.h.

◆ optimizeParagraph()

template<class Trait>
std::shared_ptr< Paragraph< Trait > > MD::optimizeParagraph ( std::shared_ptr< Paragraph< Trait > > & p,
TextParsingOpts< Trait > & po,
OptimizeParagraphType type = OptimizeParagraphType::Full )
inline

Optimize Paragraph.

Definition at line 8058 of file parser.h.

◆ paragraphToLabel()

template<class Trait>
Trait::String MD::paragraphToLabel ( Paragraph< Trait > * p)
inline

Convert Paragraph to label.

Definition at line 3715 of file parser.h.

◆ posOfListItem()

template<class Trait>
long long int MD::posOfListItem ( const typename Trait::String & s,
bool ordered )
inline
Returns
Position of first character in list item.

Definition at line 3331 of file parser.h.

◆ prepareTableData()

template<class Trait>
Trait::InternalString MD::prepareTableData ( typename Trait::InternalString s)
inline

Prepare data in table cell for parsing.

Definition at line 3923 of file parser.h.

◆ prevPosition()

template<class Trait>
std::pair< long long int, long long int > MD::prevPosition ( const MdBlock< Trait > & fr,
long long int pos,
long long int line )
inline
Returns
Previous position in the block.

Definition at line 4180 of file parser.h.

◆ processGitHubAutolinkExtension()

template<class Trait>
long long int MD::processGitHubAutolinkExtension ( std::shared_ptr< Paragraph< Trait > > p,
TextParsingOpts< Trait > & po,
long long int idx )
inline

Process GitHub autolinks for the text with index idx.

Definition at line 1279 of file parser.h.

◆ readEscapedSequence()

template<class Trait>
Trait::String MD::readEscapedSequence ( long long int i,
const typename Trait::String & str,
long long int * endPos = nullptr )
inline

Skip escaped sequence of characters till first space.

Definition at line 432 of file parser.h.

◆ readHtmlAttr()

template<class Trait>
std::pair< bool, bool > MD::readHtmlAttr ( long long int & l,
long long int & p,
const typename MdBlock< Trait >::Data & fr,
bool checkForSpace )
inline

Read HTML attribute.

Definition at line 4863 of file parser.h.

◆ readHtmlAttrValue()

template<class Trait>
std::pair< bool, bool > MD::readHtmlAttrValue ( long long int & l,
long long int & p,
const typename MdBlock< Trait >::Data & fr )
inline

Read HTML attribute value.

Definition at line 4806 of file parser.h.

◆ readLinkDestination()

template<class Trait>
std::tuple< long long int, long long int, bool, typename Trait::String, long long int > MD::readLinkDestination ( long long int line,
long long int pos,
const TextParsingOpts< Trait > & po,
WithPosition * urlPos = nullptr )
inline

Read link's destination.

Definition at line 6698 of file parser.h.

◆ readLinkTitle()

template<class Trait>
std::tuple< long long int, long long int, bool, typename Trait::String, long long int > MD::readLinkTitle ( long long int line,
long long int pos,
const TextParsingOpts< Trait > & po )
inline

Read link's title.

Definition at line 6815 of file parser.h.

◆ readUnquotedHtmlAttrValue()

template<class Trait>
std::pair< bool, bool > MD::readUnquotedHtmlAttrValue ( long long int & l,
long long int & p,
const typename MdBlock< Trait >::Data & fr )
inline

Read HTML attribute value.

Definition at line 4782 of file parser.h.

◆ removeBackslashes() [1/2]

template<class String, class Trait>
String MD::removeBackslashes ( const String & s)
inline

Remove backslashes from the string.

Definition at line 475 of file parser.h.

◆ removeBackslashes() [2/2]

template<class Trait>
MdBlock< Trait >::Data MD::removeBackslashes ( const typename MdBlock< Trait >::Data & d)
inline

Remove backslashes in block.

Definition at line 818 of file parser.h.

◆ removeLineBreak()

template<class Trait>
Trait::String MD::removeLineBreak ( const typename Trait::String & s)
inline

Remove line break from the end of string.

Definition at line 4494 of file parser.h.

◆ removeSpacesAtEnd()

template<class String>
void MD::removeSpacesAtEnd ( String & s)
inline

Remove spaces at the end of string s.

Definition at line 99 of file parser.h.

◆ replaceEntity()

template<class Trait>
Trait::String MD::replaceEntity ( const typename Trait::String & s)
inline

Replace entities in the string with corresponding character.

Definition at line 735 of file parser.h.

◆ replaceTabs()

template<class Trait>
void MD::replaceTabs ( typename Trait::InternalString & s)
inline

Replace tabs with spaces (just for internal simpler use).

Definition at line 2499 of file parser.h.

◆ resetHtmlTag()

template<class Trait>
void MD::resetHtmlTag ( RawHtmlBlock< Trait > & html,
TextParsingOpts< Trait > * po = nullptr )
inline

Reset pre-stored HTML.

Definition at line 1006 of file parser.h.

◆ resolveLinks()

template<class Trait>
void MD::resolveLinks ( typename Trait::StringList & linksToParse,
std::shared_ptr< Document< Trait > > doc )

Resolve links in the document.

Definition at line 3231 of file parser.h.

◆ setLastPos()

template<class Trait>
void MD::setLastPos ( std::shared_ptr< Item< Trait > > item,
long long int pos,
long long int line )
inline

Set last position of the item.

Definition at line 9104 of file parser.h.

◆ skipSpaces()

template<class Trait>
long long int MD::skipSpaces ( long long int i,
const typename Trait::String & line )
inline

Skip spaces in line from position i.

Definition at line 71 of file parser.h.

◆ skipSpacesInHtml()

template<class Trait>
void MD::skipSpacesInHtml ( long long int & l,
long long int & p,
const typename MdBlock< Trait >::Data & fr )
inline

Skip spaces.

Definition at line 4763 of file parser.h.

◆ skipSpacesUpTo1Line()

template<class Trait>
void MD::skipSpacesUpTo1Line ( long long int & line,
long long int & pos,
const typename MdBlock< Trait >::Data & fr )
inline

Skip space in the block up to 1 new line.

Definition at line 6683 of file parser.h.

◆ splitParagraphsAndFreeHtml()

template<class Trait>
std::shared_ptr< Paragraph< Trait > > MD::splitParagraphsAndFreeHtml ( std::shared_ptr< Block< Trait > > parent,
std::shared_ptr< Paragraph< Trait > > p,
TextParsingOpts< Trait > & po,
bool collectRefLinks,
bool fullyOptimizeParagraphs = true )
inline

Split Paragraph and free HTML.

Definition at line 8172 of file parser.h.

◆ splitString()

template<class Trait>
Trait::StringList MD::splitString ( const typename Trait::String & str,
const typename Trait::Char & ch )

Split string.

◆ splitString< QStringTrait >()

template<>
QStringTrait::StringList MD::splitString< QStringTrait > ( const QString & str,
const QChar & ch )
inline

Definition at line 675 of file parser.h.

◆ splitString< UnicodeStringTrait >()

Definition at line 664 of file parser.h.

◆ splitTableRow()

template<class Trait>
std::pair< typename Trait::InternalStringList, std::vector< long long int > > MD::splitTableRow ( const typename Trait::InternalString & s)
inline

Split table's row on cells.

Definition at line 3933 of file parser.h.

◆ startSequence()

template<class Trait>
Trait::String MD::startSequence ( const typename Trait::String & line)
inline
Returns
Starting sequence of the same characters.

Definition at line 111 of file parser.h.

◆ stringToLabel()

template<class Trait>
Trait::String MD::stringToLabel ( const typename Trait::String & s)
inline

Convert string to label.

Definition at line 3694 of file parser.h.

◆ styleToTextOption()

TextOption MD::styleToTextOption ( Style s)
inline
Returns
Text option from style.

Definition at line 878 of file parser.h.

◆ textAtIdx()

template<class Trait>
long long int MD::textAtIdx ( std::shared_ptr< Paragraph< Trait > > p,
size_t idx )
inline
Returns
Index of text item for the given index in raw text data.

Definition at line 8454 of file parser.h.

◆ toHtml()

template<class Trait, class HtmlVisitor = details::HtmlVisitor<Trait>>
Trait::String MD::toHtml ( std::shared_ptr< Document< Trait > > doc,
bool wrapInBodyTag = true,
const typename Trait::String & hrefForRefBackImage = {},
bool wrapInArticle = true )

Convert Document to HTML.

Parameters
docMarkdown document.
wrapInBodyTagWrap HTML into <body> tag?
hrefForRefBackImageString that will be applied as URL for image for back link from footnote.
wrapInArticleWrap HTML with <article> tag?

Definition at line 763 of file html.h.

◆ updateLastPosInList()

template<class Trait>
void MD::updateLastPosInList ( const RawHtmlBlock< Trait > & html)
inline

Update last position of all parent.

Definition at line 9115 of file parser.h.

◆ virginSubstr()

template<class Trait>
Trait::String MD::virginSubstr ( const MdBlock< Trait > & fr,
const WithPosition & virginPos )
inline
Returns
Substring from fragment with given virgin positions.

Definition at line 1026 of file parser.h.

Variable Documentation

◆ s_canBeEscaped

template<class Trait>
const Trait::String MD::s_canBeEscaped
static
Initial value:
=
Trait::latin1ToString("!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~")

Characters that can be escaped.

Definition at line 469 of file parser.h.

◆ s_entityMap

template<class Trait>
const std::map<typename Trait::String, const char16_t *> MD::s_entityMap
static

Definition at line 17 of file entities_map.h.

◆ s_startComment

const char* MD::s_startComment = "<!--"
static

Starting HTML comment string.

Definition at line 47 of file parser.h.

This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Feb 21 2025 11:45:45 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.