Skip to main content
Version: 1.2.x

Diagrams

Description

ParsedownExtended introduces support for incorporating diagrams directly into Markdown documents, enhancing visual representation and understanding. This feature recognizes syntax intended for diagram rendering, specifically designed to work with ChartJS and Mermaid. ParsedownExtended ensures that diagram code is preserved and remains unaltered for client-side rendering, requiring the inclusion of ChartJS and Mermaid JavaScript libraries in your project.

Configuration Syntax

Enable the diagrams feature in ParsedownExtended using the setSetting method:

$ParsedownExtended->setSetting('diagrams', (boolean) $value);

Parameters

This feature allows the following configurations:

  • chartjs: Enable or disable support for ChartJS diagrams.
  • mermaid: Enable or disable support for Mermaid diagrams.

Examples

Enable Diagrams

To activate diagram support, ensuring that Markdown containing ChartJS or Mermaid syntax is properly recognized and left intact for client-side rendering:

$ParsedownExtended->setSetting('diagrams', true);

Disable a Specific Diagram Type

To disable support for a specific diagram type, such as ChartJS:

$ParsedownExtended->setSetting('diagrams', [
'chartjs' => false
]);