Jump to content

Rozšíření:Kroki

From mediawiki.org
This page is a translated version of the page Extension:Kroki and the translation is 100% complete.
Příručka k rozšířením MediaWiki
Kroki
Stav rozšíření: stabilní
Implementace Značka
Popis Proměňte text v dynamické vizuály: Pomocí Kroki můžete vytvářet různé diagramy, které se bezproblémově integrují do vašich wiki stránek.
Autoři (CptLausebaerdiskuse)
Nejnovější verze 1.0.1 (2025-01-24)
MediaWiki 1.40+
Změny v databázi Ne
$wgKrokiServerEndpoint
‎<kroki>
Licence GNU General Public License 3.0
Stáhnout

Rozšíření Kroki využívá sjednocené API nabízené rozhraním kroki.io k vytváření diagramů přímo z textových popisů.

Diagramy uložené v textové podobě lze verzovat a ukládat přímo na vaše wiki stránky.

Navíc je lze v případě potřeby rychle aktualizovat nebo vyměnit. Obrázky nebudou spravovány v databázi MediaWiki.

This extension provide a dialog for WikiEditor and also for the VisualEditor.

Instalace

  • Ke stažení soubor/y a vložte je do adresáře pojmenovaného Kroki ve vaší složce extensions/.
  • Na konec vašeho souboru LocalSettings.php přidejte následující kód:
    wfLoadExtension( 'Kroki' );
    $wgKrokiServerEndpoint = "https://kroki.io";
    
  • Yes Dokončeno – Přejděte na stránku Special:Version vaší wiki a zkontrolujte, zda bylo rozšíření úspěšně nainstalováno.

Konfigurační parametry

  • $wgKrokiServerEndpoint sets the endpoint to use.

The default value is https://kroki.io. In order to address privacy issues and optimize performance, you should modify the server endpoint URL for the Kroki Service and use your own instance of kroki.

This can be done by adjusting the $wgKrokiServerEndpoint in the LocalSettings.php file.

For setting up the service on your own, official Docker images are available at "https://github.com/yuzutech/kroki".

Refer to the Kroki Documentation for more details on setup process: Kroki Documentation

Použití

This extension adds the ‎<kroki> tag.

The `lang` attribute defines the diagram type to be used for rendering the content provided.

An example in wikitext looks like this:

<kroki lang="blockdiag">
blockdiag {
  Kroki -> generates -> "Block diagrams";
  Kroki -> is -> "very easy!";

  Kroki [color = "greenyellow"];
  "Block diagrams" [color = "pink"];
  "very easy!" [color = "orange"];
}
</kroki>

The code above will render an image with SVG content formatted as a data URL.

<img src="data:image/svg+xml;base64,PHN2ZyB2aW...">

Available Diagram Types

The following diagram types are currently supported:

$diagramTypes = [
  'blockdiag',
  'bpmn',
  'bytefield',
  'seqdiag',
  'actdiag',
  'nwdiag',
  'packetdiag',
  'rackdiag',
  'c4plantuml',
  'd2',
  'dbml',
  'ditaa',
  'erd',
  'excalidraw',
  'graphviz',
  'mermaid',
  'nomnoml',
  'pikchr',
  'plantuml',
  'structurizr',
  'svgbob',
  'symbolator',
  'tikz',
  'vega',
  'vegalite',
  'wavedrom',
  'wireviz'
];

For additional information, refer to the Kroki documentation at https://docs.kroki.io/kroki/.