Movatterモバイル変換


[0]ホーム

URL:


Jump to content
MediaWiki
Search

Extension:Flex Diagrams

From mediawiki.org
MediaWiki extensions manual
Flex Diagrams
Release status: stable
ImplementationSpecial page,ContentHandler
DescriptionAn extension that allows for creating and modifying diagrams in various formats using graphical editors.
Author(s)Yaron Koren <yaron57@gmail.com> and Sahaj Khandelwal
Latest version0.9 (July 2025)
Compatibility policyMaster maintains backward compatibility.
MediaWiki1.41+
  • $wgFlexDiagramsEnabledFormats
  • $wgFlexDiagramsDrawioUseSVG
  • $wgFlexDiagramsDrawioRenderSVG
LicenseGNU General Public License 2.0 or later
DownloadSeeExtension:Flex Diagrams#Download
Translate the Flex Diagrams extension if it is available at translatewiki.net
IssuesOpen tasks ·Report a bug

Flex Diagrams is an extension that lets you create, and display, five different types of diagrams:

Each of these diagram types gets its own namespace.

Any such diagram page will get, in addition to the standard "Edit" tab, an "Edit diagram" tab that allows for editing these diagrams in a graphical way. Thus, any diagram can be edited either as text, or graphically. (Although the editors for DOT and Mermaid are unfortunately not true graphical editors, but simply text editors that include a preview element.)

Download

[edit]

You can download the Flex Diagrams code, in .zip format,here.

You can also download the code directly via Git from the MediaWiki source code repository (seeavailable tags). From a command line, call the following:

gitclonehttps://gerrit.wikimedia.org/r/mediawiki/extensions/FlexDiagrams.git

You can view the code online, including version history for each file, on eitherGerrit orPhabricator.

Installation

[edit]

Once you have obtained a "FlexDiagrams" directory and placed it in your /extensions directory, add the following to LocalSettings.php:

wfLoadExtension('FlexDiagrams');

Usage

[edit]

Creating diagrams

[edit]

A BPMN, DOT, Drawio/diagrams.net, Gantt, or Mermaid diagram can be created by creating a page in the appropriate namespace (BPMN:,DOT:,Drawio:,Gantt:, orMermaid: respectively), for example "BPMN:Approval process".

If you go to such a page before it is created, you will see a tab there, defined by Flex Diagrams, called"Create diagram". Clicking on it will launch an interactive diagram editor as shownbelow. Similarly, any such page, after being created, will have a tab called"Edit diagram", which will launch the same editor.

Adding links to BPMN diagrams

[edit]

One customization specific to the Flex Diagrams extension is that, when generating a BPMN diagram, you can make any element be a link to a different wiki page. To do this, add the name of the page you want to link to, within double square brackets, at the end of the element title - after either a space or a newline. An example would be a node called "Get approval". Let's say there's a separate page, "BPMN:Approval process", which details all the steps of the process referred to as "Get approval". We can make the "Get approval" node link to "BPMN:Approval process" by changing its label to read "Get approval [[BPMN:Approval process]]". When the diagram is displayed, the link part will not be shown on the screen; instead, the entire node will appear as blue and become a clickable link. You can see examples of how such linking gets displayed in the gallery below.

Using SVG for Drawio/diagrams.net diagrams

[edit]

Drawio/diagrams.net can be saved on the page in SVG format, instead of their native format, by adding the following to LocalSettings.php:

$wgFlexDiagramsDrawioUseSVG=true;

In addition, regardless of how such diagrams are stored, they can bedisplayed using SVG, both on their own pages and elsewhere, by adding the following to LocalSettings.php:

$wgFlexDiagramsDrawioRenderSVG=true;

Using SVG for the display allows the text in the diagram to be searachable, and displays better in dark mode.

Displaying diagrams

[edit]

Any diagram can be displayed on any page by using the #display_diagram function. This function takes in a single argument, a page name, and displays the diagram defined on that page. An example would be:

{{#display_diagram:BPMN:Approval process}}

Screenshots

[edit]
  • The "edit diagram" interface for a BPMN diagram
    The "edit diagram" interface for a BPMN diagram
  • The display of this BPMN diagram
    The display of this BPMN diagram
  • The "edit diagram" interface for a Gantt chart
    The "edit diagram" interface for a Gantt chart
  • The "edit diagram" interface for a Mermaid diagram
    The "edit diagram" interface for a Mermaid diagram
  • The "edit diagram" interface for a Draw.io/diagrams.net diagram
    The "edit diagram" interface for a Draw.io/diagrams.net diagram

Version history

[edit]
  • 0.1 - July 22, 2020 - Initial version
  • 0.2 - November 16, 2020 - Fix handling for MW < 1.33; linking capability added to BPMN; JS fixes; disable caching for BPMN display; other fixes
  • 0.3 - October 4, 2021 - Removed handling for MW < 1.31; added handling for MW 1.38+; added zooming for BPMN and Gantt; changed red links to diagrams to point to "action=editdiagram"; added "Leave site?" popup to diagram edit interface; other fixes
  • 0.4 - March 24, 2022 - Added Drawio/diagrams.net handling; upgraded Mermaid version; code improvements
  • 0.5 - March 30, 2023 - Removed handling for MW < 1.33; improved handling for MW 1.38+; improved colors and added "weeks" option to Gantt charts
  • 0.5.1 - July 12, 2023 - Improved support for MW >= 1.33; updated Mermaid to 10.2.1
  • 0.5.2 - February 19, 2024 - Coding improvements
  • 0.6 - July 10, 2024 - Removed handling for MW < 1.38; updated Mermaid to 10.9.0
  • 0.7 - December 31, 2024 - Added handling for DOT (Graphviz) diagrams; added subtitle display of incoming links to diagram pages; updated bpmn-js to 18.1.1
  • 0.7.1 - January 29, 2025 - Restored support for MW < 1.41, accidentally removed in version 0.7
  • 0.8 - April 9, 2025 - Removed handling for MW < 1.40; improved handling for MW 1.44+
  • 0.8.1 - July 17, 2025 - Fixed handling of #display_diagram for MW 1.44+
  • 0.9 - November 5, 2025 - Removed handling for MW 1.40; improved handling for MW 1.42+; improved editing and display of Drawio/diagrams.net diagrams (added support for displaying multiple such diagrams on the same page; removed secondary save step; added SVG saving and rendering support via new $wgFlexDiagramsDrawioUseSVG and $wgFlexDiagramsDrawioRenderSVG settings; improved dark mode display; added fullscreen mode; other fixes)

See also

[edit]
This extension is included in the following wiki farms/hosts and/or packages:
Retrieved from "https://www.mediawiki.org/w/index.php?title=Extension:Flex_Diagrams&oldid=8002524"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2026 Movatter.jp