This wiki is being moved to a new server and cannot be edited. Please sit tight. Thank you.

User:Tenbergen/Mermaid with SMW

From semantic-mediawiki.org
< Tina Tenbergen
Tina TenbergenUser:Tenbergen/Mermaid with SMW

While it isn't technically a results format, mw:Extension:Mermaid can be used to generate graphic output from an SMW query. Help:Gantt format requires Mermaid as well.

This might be an alternative for people who cannot install mw:Extension:GraphViz/Extension "GraphViz" required by results formats Help:Graph_format and Help:Process format because they don't have sudo/admin rights on their server that are required to install graphviz and mscgen required by that extension.

Setting up Mermaid[edit]

See mw:Extension:Mermaid

Using Mermaid[edit]

See the bottom of https://github.com/SemanticMediaWiki/Mermaid/

Using Mermaid with SMW[edit]

To use Mermaid with SMW, use an inline query that uses a template to generate mermaid syntax inside a mermaid tag.

Some important considerations:

  • use the Help:Plainlist_format with import-annotation=yes (or the Help:Template_format pre SMW 3)
  • mermaid ids (the first parts on lines in mermaid syntax) can't have spaces, so if you are using page names, they would have to be page names without spaces; one work around is to declare a guaranteed unique property such as {{#set:OrgChartID={{PAGEID}}}}
  • several queries with different templates within the mermaid tag may be needed to get all the mermaid syntax generated
  • Mermaid will not show the graph in preview mode, you need to save it (like some other results formats)
  • do not use <br> or similar in your template - this works when the template is viewed and the output copied into a mermaid tag, but breaks when the query is in the mermaid tag
  • it may be necessary to start the template call with a blank line [1]

Example[edit]

As of 2019-03-19 Mermaid is not installed in the sandbox, so see:

to do[edit]

When this goes to its future home I will want to add a link into https://www.mediawiki.org/wiki/Extension_talk:Mermaid#Using%20Mermaid%20with%20SMW%20SRF%20(SEP%20issue) to this page.