PHP Class League\HTMLToMarkdown\HtmlConverter

A helper class to convert HTML to Markdown.
Author: Colin O'Dell ([email protected])
Author: Nick Cernis ([email protected])
Afficher le fichier Open project: nickcernis/html-to-markdown Class Usage Examples

Protected Properties

Свойство Type Description
$environment Environment

Méthodes publiques

Méthode Description
__construct ( array $options = [] ) Constructor
__invoke ( string $html ) : string Convert
convert ( $html ) : string Convert
getConfig ( ) : League\HTMLToMarkdown\Configuration
getEnvironment ( ) : Environment

Méthodes protégées

Méthode Description
convertToMarkdown ( League\HTMLToMarkdown\ElementInterface $element ) : string Convert to Markdown
sanitize ( string $markdown ) : string

Private Methods

Méthode Description
convertChildren ( League\HTMLToMarkdown\ElementInterface $element ) Convert Children
createDOMDocument ( string $html ) : DOMDocument

Method Details

__construct() public méthode

Constructor
public __construct ( array $options = [] )
$options array Configuration options

__invoke() public méthode

Convert
See also: HtmlConverter::convert
public __invoke ( string $html ) : string
$html string
Résultat string The Markdown version of the html

convert() public méthode

Loads HTML and passes to getMarkdown()
public convert ( $html ) : string
$html
Résultat string The Markdown version of the html

convertToMarkdown() protected méthode

Converts an individual node into a #text node containing a string of its Markdown equivalent. Example: An

node with text content of 'Title' becomes a text node with content of '### Title'

protected convertToMarkdown ( League\HTMLToMarkdown\ElementInterface $element ) : string
$element League\HTMLToMarkdown\ElementInterface
Résultat string The converted HTML as Markdown

getConfig() public méthode

public getConfig ( ) : League\HTMLToMarkdown\Configuration
Résultat League\HTMLToMarkdown\Configuration

getEnvironment() public méthode

public getEnvironment ( ) : Environment
Résultat Environment

sanitize() protected méthode

protected sanitize ( string $markdown ) : string
$markdown string
Résultat string

Property Details

$environment protected_oe property

protected Environment,League\HTMLToMarkdown $environment
Résultat Environment