MD::Parser

Search for usage in LXR

MD::Parser< Trait > Class Template Referencefinal

#include <parser.h>

Public Member Functions

 Parser ()
 
 ~Parser ()=default
 
void addTextPlugin (int id, TextPluginFunc< Trait > plugin, bool processInLinks, const typename Trait::StringList &userData)
 
std::shared_ptr< Document< Trait > > parse (const typename Trait::String &fileName, bool recursive=true, const typename Trait::StringList &ext={Trait::latin1ToString("md"), Trait::latin1ToString("markdown")}, bool fullyOptimizeParagraphs=true)
 
std::shared_ptr< Document< Trait > > parse (typename Trait::TextStream &stream, const typename Trait::String &path, const typename Trait::String &fileName, bool fullyOptimizeParagraphs=true)
 
void removeTextPlugin (int id)
 

Detailed Description

template<class Trait>
class MD::Parser< Trait >

Markdown parser.

Definition at line 1421 of file parser.h.

Constructor & Destructor Documentation

◆ Parser()

template<class Trait >
MD::Parser< Trait >::Parser ( )
inline

Definition at line 1424 of file parser.h.

◆ ~Parser()

template<class Trait >
MD::Parser< Trait >::~Parser ( )
default

Member Function Documentation

◆ addTextPlugin()

template<class Trait >
void MD::Parser< Trait >::addTextPlugin ( int id,
TextPluginFunc< Trait > plugin,
bool processInLinks,
const typename Trait::StringList & userData )
inline

Add text plugin.

Parameters
idID of a plugin. Use TextPlugin::UserDefinedPluginID value for start ID.
pluginFunction of a plugin, that will be invoked to processs raw text.
processInLinksShould this plugin be used in parsing of internals of links?
userDataUser data that will be passed to plugin function.

Definition at line 1468 of file parser.h.

◆ parse() [1/2]

template<class Trait >
std::shared_ptr< Document< Trait > > MD::Parser< Trait >::parse ( const typename Trait::String & fileName,
bool recursive = true,
const typename Trait::StringList & ext = {Trait::latin1ToString("md"), Trait::latin1ToString("markdown")},
bool fullyOptimizeParagraphs = true )
inline
Returns
Parsed Markdown document.
Parameters
fileNameFile name of the Markdown document.
recursiveShould parsing be recursive? If recursive all links to existing Markdown files will be parsed and presented in the returned document.
extAllowed extensions for Markdonw document files. If Markdown file doesn't have given extension it will be ignored.
fullyOptimizeParagraphsMake full optimization, or just semi one. In full optimization text items with one style but with some closing delimiters in the middle will be concatenated in one, like in **text* text*, here in full optimization will be "text text" with 2 open/close style delimiters, but one closing delimiter is in the middle.

Definition at line 2091 of file parser.h.

◆ parse() [2/2]

template<class Trait >
std::shared_ptr< Document< Trait > > MD::Parser< Trait >::parse ( typename Trait::TextStream & stream,
const typename Trait::String & path,
const typename Trait::String & fileName,
bool fullyOptimizeParagraphs = true )
inline
Returns
Parsed Markdown document.
Parameters
streamStream to parse.
pathAbsolute path to the root folder for the document. This path will be used to resolve local links.
fileNameThis argument needed only for anchor.
fullyOptimizeParagraphsMake full optimization, or just semi one. In full optimization text items with one style but with some closing delimiters in the middle will be concatenated in one, like in **text* text*, here in full optimization will be "text text" with 2 open/close style delimiters, but one closing delimiter is in the middle.

Definition at line 2109 of file parser.h.

◆ removeTextPlugin()

template<class Trait >
void MD::Parser< Trait >::removeTextPlugin ( int id)
inline

Remove text plugin.

Parameters
idID of plugin that should be removed.

Definition at line 1483 of file parser.h.


The documentation for this class was generated from the following file:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:04:36 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.