plugins-registry.html 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. <!DOCTYPE html
  2. SYSTEM "about:legacy-compat">
  3. <html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="UTF-8"><meta name="copyright" content="(C) Copyright 2019"><meta name="DC.rights.owner" content="(C) Copyright 2019"><meta name="DC.type" content="topic"><meta name="description" content="DITA-OT 3.2 supports a new plug-in registry that makes it easier to discover and install new plug-ins. The registry provides a searchable list of plug-ins at dita-ot.org/plugins."><meta name="DC.subject" content="PDF, plug-in, command, dita, plug-in registry, plug-ins, registry, installing, GitHub, URL"><meta name="keywords" content="PDF, plug-in, command, dita, plug-in registry, plug-ins, registry, installing, GitHub, URL"><meta name="DC.relation" scheme="URI" content="../topics/custom-plugins.html"><meta name="DC.relation" scheme="URI" content="../topics/plugins-installing.html"><meta name="DC.format" content="HTML5"><meta name="DC.identifier" content="plugin-registry"><link rel="stylesheet" type="text/css" href="../css/commonltr.css"><link rel="stylesheet" type="text/css" href="../css/dita-ot-doc.css"><title>Adding plug-ins via the registry</title></head><body id="plugin-registry"><header role="banner"><div class="header">
  4. <p>DITA Open Toolkit</p>
  5. <hr>
  6. </div></header><nav role="toc"><ul><li><a href="../index.html">DITA Open Toolkit 3.3</a></li><li><a href="../release-notes/index.html">Release Notes</a></li><li><a href="../topics/installing-client.html">Installing DITA-OT</a></li><li><a href="../topics/alternative-input-formats.html">Authoring formats</a></li><li><a href="../topics/building-output.html">Building output</a></li><li><a href="../parameters/index.html">Setting parameters</a></li><li><a href="../topics/customizing.html">Customizing DITA-OT</a><ul><li><a href="../topics/html-customization.html">Customizing HTML</a></li><li><a href="../topics/pdf-customization.html">Customizing PDF</a></li><li><a href="../topics/custom-plugins.html">Working with plug-ins</a><ul><li><a href="../topics/plugins-installing.html">Installing plug-ins</a></li><li><a href="../topics/plugins-removing.html">Removing plug-ins</a></li><li class="active"><a href="../topics/plugins-registry.html">Plug-in registry</a></li><li><a href="../topics/plugin-configfile.html">Plug-in descriptor file</a></li><li><a href="../topics/plugin-dependencies.html">Plug-in dependencies</a></li><li><a href="../topics/plugin-applications.html">Plug-in applications</a></li><li><a href="../topics/plugin-sample.html">Example plugin.xml file</a></li><li><a href="../topics/plugin-best-practices.html">Best practices</a></li><li><a href="../topics/plugin-coding-conventions.html">Coding conventions</a></li></ul></li><li><a href="../extension-points/plugin-extension-points.html">Extension points</a></li><li><a href="../topics/migration.html">Migrating customizations</a></li><li><a href="../topics/globalization.html">Globalizing DITA content</a></li><li><a href="../topics/rebuilding-docs.html">Rebuilding documentation</a></li></ul></li><li><a href="../topics/troubleshooting-overview.html">Troubleshooting</a></li><li><a href="../reference/index.html">Reference</a></li><li><a href="../topics/dita-and-dita-ot-resources.html">Resources</a></li></ul></nav><main role="main"><article role="article" aria-labelledby="ariaid-title1">
  7. <h1 class="title topictitle1" id="ariaid-title1">Adding plug-ins via the registry</h1>
  8. <div class="body"><p class="shortdesc"><span class="ph" id="plugin-registry__registry-summary">DITA-OT 3.2 supports a new plug-in registry that makes it easier to discover and
  9. install new plug-ins. The registry provides a searchable list of plug-ins at <a class="xref" href="https://www.dita-ot.org/plugins" target="_blank">dita-ot.org/plugins</a>.</span></p>
  10. <section class="section" id="plugin-registry__background">
  11. <p class="p">In the past, installing plug-ins required you to either download a plug-in to your computer and provide the
  12. path to the plug-in archive (.zip file) or pass the URL of the plug-in distribution file to the
  13. <span class="keyword cmdname">dita</span> command and let DITA-OT download the file. This required that you know the URL of the
  14. plug-in distribution package.</p>
  15. </section>
  16. <section class="section" id="plugin-registry__using-the-registry"><h2 class="title sectiontitle">Installing plug-ins from the registry</h2>
  17. <p class="p">With the registry, you can now search the list of available plug-ins at <a class="xref" href="https://www.dita-ot.org/plugins" target="_blank">dita-ot.org/plugins</a>
  18. and install new plug-ins by name and optional version.</p>
  19. <p class="p">Search the registry for a plug-in and install it by providing the plug-in name to the <span class="keyword cmdname">dita</span>
  20. command.</p>
  21. <pre class="pre codeblock"><code><span class="keyword cmdname">dita</span> <span class="keyword parmname">--install</span>=<var class="keyword varname">&lt;plugin-name&gt;</var></code></pre>
  22. <p class="p">If the registry includes multiple versions of the same plug-in, you can specify the version to install as
  23. follows:</p>
  24. <pre class="pre codeblock"><code><span class="keyword cmdname">dita</span> <span class="keyword parmname">--install</span>=<var class="keyword varname">&lt;plugin-name&gt;@&lt;plugin-version&gt;</var></code></pre>
  25. <p class="p">If the plug-in requires other plug-ins, those are also installed recursively.</p>
  26. <p class="p">For example, to revert PDF output to the legacy PDF2 layout that was the default in DITA-OT before 2.5, install
  27. the <span class="ph filepath">org.dita.pdf2.legacy</span> plug-in as follows:</p>
  28. <pre class="pre codeblock"><code><span class="keyword cmdname">dita</span> <span class="keyword parmname">--install</span>=org.dita.pdf2.legacy</code></pre>
  29. <p class="p">If a matching plug-in cannot be found, an error message will appear. Possible reasons for failure include:</p>
  30. <ul class="ul">
  31. <li class="li">A plug-in with the specified name was not found in the registry</li>
  32. <li class="li">A plug-in with the specified version was not found in the registry</li>
  33. <li class="li">The specified plug-in version is not compatible with the installed DITA-OT version</li>
  34. <li class="li">None of the available plug-in versions are compatible with the installed DITA-OT version</li>
  35. </ul>
  36. </section>
  37. <section class="section" id="plugin-registry__publishing-to-registry"><h2 class="title sectiontitle">Publishing plug-ins to the registry</h2>
  38. <p class="p">The contents of the DITA Open Toolkit plug-in registry are stored in a Git repository at <a class="xref" href="https://github.com/dita-ot/registry" target="_blank">github.com/dita-ot/registry</a>. New plug-ins or new versions can be added by sending a <a class="xref" href="https://help.github.com/articles/about-pull-requests/" target="_blank">pull request</a>
  39. that includes a single new plug-in entry in JavaScript Object Notation (JSON) format.</p>
  40. <div class="note note note_note"><span class="note__title">Note:</span> As for all other contributions to the project, pull requests to the registry must be signed off by passing
  41. the <code class="ph codeph">--signoff</code> option to the <span class="keyword cmdname">git commit</span> command to certify that you have the
  42. rights to submit this contribution. For more information on this process, see <a class="xref" href="https://www.dita-ot.org/DCO" target="_blank">signing your work</a>.</div>
  43. <p class="p">The version entries for each plug-in are stored in a file that is named after the plug-in ID as
  44. <code class="ph codeph">&lt;plugin-name&gt;.json</code>. The file contains an array of entries with a pre-defined structure.
  45. You should have one entry for each supported version of the plug-in.</p>
  46. <table class="table table-hover frame-none"><caption><span class="table--title-label">Table 1. </span><span class="title">Plug-in version entry structure</span></caption><colgroup><col style="width:20%"><col style="width:20%"><col style="width:60%"></colgroup><thead class="thead">
  47. <tr class="row">
  48. <th class="entry colsep-0 rowsep-1" id="plugin-registry__publishing-to-registry__entry__1">Key</th>
  49. <th class="entry colsep-0 rowsep-1" id="plugin-registry__publishing-to-registry__entry__2">Mandatory</th>
  50. <th class="entry colsep-0 rowsep-1" id="plugin-registry__publishing-to-registry__entry__3">Description</th>
  51. </tr>
  52. </thead><tbody class="tbody">
  53. <tr class="row">
  54. <td class="entry colsep-0 rowsep-1" headers="plugin-registry__publishing-to-registry__entry__1"><code class="ph codeph">name</code></td>
  55. <td class="entry colsep-0 rowsep-1" headers="plugin-registry__publishing-to-registry__entry__2">yes</td>
  56. <td class="entry colsep-0 rowsep-1" headers="plugin-registry__publishing-to-registry__entry__3">Plug-in name</td>
  57. </tr>
  58. <tr class="row">
  59. <td class="entry colsep-0 rowsep-1" headers="plugin-registry__publishing-to-registry__entry__1"><code class="ph codeph">vers</code></td>
  60. <td class="entry colsep-0 rowsep-1" headers="plugin-registry__publishing-to-registry__entry__2">yes</td>
  61. <td class="entry colsep-0 rowsep-1" headers="plugin-registry__publishing-to-registry__entry__3">Plug-in version in <a class="xref" href="https://semver.org" target="_blank">Semantic Versioning 2.0.0</a> format</td>
  62. </tr>
  63. <tr class="row">
  64. <td class="entry colsep-0 rowsep-1" headers="plugin-registry__publishing-to-registry__entry__1"><code class="ph codeph">deps</code></td>
  65. <td class="entry colsep-0 rowsep-1" headers="plugin-registry__publishing-to-registry__entry__2">yes</td>
  66. <td class="entry colsep-0 rowsep-1" headers="plugin-registry__publishing-to-registry__entry__3">Array of dependency entries. The only mandatory plug-in dependency is
  67. <code class="ph codeph">org.dita.base</code>, which defines the supported DITA-OT platform.</td>
  68. </tr>
  69. <tr class="row">
  70. <td class="entry colsep-0 rowsep-1" headers="plugin-registry__publishing-to-registry__entry__1"><code class="ph codeph">url</code></td>
  71. <td class="entry colsep-0 rowsep-1" headers="plugin-registry__publishing-to-registry__entry__2">yes</td>
  72. <td class="entry colsep-0 rowsep-1" headers="plugin-registry__publishing-to-registry__entry__3">Absolute URL to plug-in distribution file</td>
  73. </tr>
  74. <tr class="row">
  75. <td class="entry colsep-0 rowsep-1" headers="plugin-registry__publishing-to-registry__entry__1"><code class="ph codeph">cksum</code></td>
  76. <td class="entry colsep-0 rowsep-1" headers="plugin-registry__publishing-to-registry__entry__2">no</td>
  77. <td class="entry colsep-0 rowsep-1" headers="plugin-registry__publishing-to-registry__entry__3">SHA-256 hash of the plug-in distribution file</td>
  78. </tr>
  79. <tr class="row">
  80. <td class="entry colsep-0 rowsep-1" headers="plugin-registry__publishing-to-registry__entry__1"><code class="ph codeph">description</code></td>
  81. <td class="entry colsep-0 rowsep-1" headers="plugin-registry__publishing-to-registry__entry__2">no</td>
  82. <td class="entry colsep-0 rowsep-1" headers="plugin-registry__publishing-to-registry__entry__3">Description of the plug-in</td>
  83. </tr>
  84. <tr class="row">
  85. <td class="entry colsep-0 rowsep-1" headers="plugin-registry__publishing-to-registry__entry__1"><code class="ph codeph">keywords</code></td>
  86. <td class="entry colsep-0 rowsep-1" headers="plugin-registry__publishing-to-registry__entry__2">no</td>
  87. <td class="entry colsep-0 rowsep-1" headers="plugin-registry__publishing-to-registry__entry__3">Array of keywords</td>
  88. </tr>
  89. <tr class="row">
  90. <td class="entry colsep-0 rowsep-1" headers="plugin-registry__publishing-to-registry__entry__1"><code class="ph codeph">homepage</code></td>
  91. <td class="entry colsep-0 rowsep-1" headers="plugin-registry__publishing-to-registry__entry__2">no</td>
  92. <td class="entry colsep-0 rowsep-1" headers="plugin-registry__publishing-to-registry__entry__3">Plug-in homepage URL</td>
  93. </tr>
  94. <tr class="row">
  95. <td class="entry colsep-0 rowsep-1" headers="plugin-registry__publishing-to-registry__entry__1"><code class="ph codeph">license</code></td>
  96. <td class="entry colsep-0 rowsep-1" headers="plugin-registry__publishing-to-registry__entry__2">no</td>
  97. <td class="entry colsep-0 rowsep-1" headers="plugin-registry__publishing-to-registry__entry__3">License in <a class="xref" href="https://spdx.org/licenses/" target="_blank">SPDX</a>
  98. format</td>
  99. </tr>
  100. </tbody></table>
  101. <div class="note tip note_tip"><span class="note__title">Tip:</span> To calculate the SHA-256 checksum for the <code class="ph codeph">cksum</code> key, use <code class="ph codeph">shasum&nbsp;-a&nbsp;256
  102. <var class="keyword varname">&lt;plugin-file&gt;</var></code> on macOS or Linux. With&nbsp;Windows&nbsp;PowerShell, use
  103. <code class="ph codeph"><a class="xref" href="https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/get-filehash?view=powershell-6" target="_blank">Get-FileHash</a>&nbsp;<var class="keyword varname">&lt;plugin-file&gt;</var> |
  104. Format-List</code>.
  105. </div>
  106. <table class="table table-hover frame-none"><caption><span class="table--title-label">Table 2. </span><span class="title">Structure for dependency entries</span></caption><colgroup><col style="width:20%"><col style="width:20%"><col style="width:60%"></colgroup><thead class="thead">
  107. <tr class="row">
  108. <th class="entry colsep-0 rowsep-1" id="plugin-registry__publishing-to-registry__entry__31">Key</th>
  109. <th class="entry colsep-0 rowsep-1" id="plugin-registry__publishing-to-registry__entry__32">Mandatory</th>
  110. <th class="entry colsep-0 rowsep-1" id="plugin-registry__publishing-to-registry__entry__33">Description</th>
  111. </tr>
  112. </thead><tbody class="tbody">
  113. <tr class="row">
  114. <td class="entry colsep-0 rowsep-1" headers="plugin-registry__publishing-to-registry__entry__31"><code class="ph codeph">name</code></td>
  115. <td class="entry colsep-0 rowsep-1" headers="plugin-registry__publishing-to-registry__entry__32">yes</td>
  116. <td class="entry colsep-0 rowsep-1" headers="plugin-registry__publishing-to-registry__entry__33">Plug-in name</td>
  117. </tr>
  118. <tr class="row">
  119. <td class="entry colsep-0 rowsep-1" headers="plugin-registry__publishing-to-registry__entry__31"><code class="ph codeph">req</code></td>
  120. <td class="entry colsep-0 rowsep-1" headers="plugin-registry__publishing-to-registry__entry__32">yes</td>
  121. <td class="entry colsep-0 rowsep-1" headers="plugin-registry__publishing-to-registry__entry__33">Required plug-in version in <a class="xref" href="https://semver.org" target="_blank">Semantic Versioning 2.0.0</a> format that may contain <a class="xref" href="https://docs.npmjs.com/misc/semver#ranges" target="_blank">ranges</a>.</td>
  122. </tr>
  123. </tbody></table>
  124. <div class="note note note_note"><span class="note__title">Note:</span> Version numbers in the <code class="ph codeph">vers</code> and <code class="ph codeph">req</code> keys use the three-digit format
  125. specified by <a class="xref" href="https://semver.org" target="_blank">Semantic Versioning 2.0.0</a>. An initial development release of a plug-in might start at version 0.1.0,
  126. and an initial production release at 1.0.0. If your plug-in requires DITA-OT 3.1 or later, set the
  127. <code class="ph codeph">req</code> key to <code class="ph codeph">&gt;=3.1.0</code>. Using the greater-than sign allows your plug-in to
  128. work with compatible maintenance releases, such as 3.1.3. If the requirement is set to <code class="ph codeph">=3.1.0</code>,
  129. the registry will only offer it for installation on that exact version.</div>
  130. </section>
  131. <section class="section" id="plugin-registry__example-1"><h2 class="title sectiontitle">Sample plug-in entry file</h2>
  132. <div class="div div-index">
  133. </div>
  134. <p class="p">The example below shows an entry for the <code class="ph codeph">DocBook</code> plug-in. The complete file is available in
  135. the registry as <a class="xref" href="https://github.com/dita-ot/registry/blob/master/org.dita.docbook.json" target="_blank">org.dita.docbook.json</a>.</p>
  136. <pre class="pre codeblock language-json"><code>[
  137. {
  138. "name": "org.dita.docbook",
  139. "description": "Convert DITA to DocBook.",
  140. "keywords": ["DocBook"],
  141. "homepage": "https://github.com/dita-ot/org.dita.docbook/",
  142. "vers": "2.3.0",
  143. "license": "Apache-2.0",
  144. "deps": [
  145. {
  146. "name": "org.dita.base",
  147. "req": "&gt;=2.3.0"
  148. }
  149. ],
  150. "url": "https://github.com/dita-ot/org.dita.docbook/archive/2.3.zip",
  151. "cksum": "eaf06b0dca8d942bd4152615e39ee8cfb73a624b96d70e10ab269ed6f8a13e21"
  152. }
  153. ]</code></pre>
  154. </section>
  155. <section class="section" id="plugin-registry__multiple-versions"><h2 class="title sectiontitle">Maintaining multiple plug-in versions</h2>
  156. <p class="p">When you have multiple versions of a plug-in, include an entry for each version, separated by a comma:</p>
  157. <pre class="pre codeblock language-json"><code>[
  158. {
  159. "name": "org.example.myplugin",
  160. "vers": "1.0.1",
  161. }<strong class="ph b">,</strong>
  162. {
  163. "name": "org.example.myplugin",
  164. "vers": "2.1.0",
  165. }
  166. ]</code></pre>
  167. <div class="note tip note_tip"><span class="note__title">Tip:</span> To publish a new version of your plug-in to the registry, add a new entry to the array in the
  168. existing plug-in entry file rather than overwriting an existing entry. This allows users to install the previous
  169. version of the plug-in if they are using an older version of DITA-OT.</div>
  170. </section>
  171. <section class="section" id="plugin-registry__adding-custom-registries"><h2 class="title sectiontitle">Adding custom registries</h2>
  172. <p class="p">In addition to the main plug-in registry at <a class="xref" href="https://www.dita-ot.org/plugins" target="_blank">dita-ot.org/plugins</a>, you can create a registry of
  173. your own to store the custom plug-ins for your company or organization.</p>
  174. <p class="p">A registry is just a directory that contains JSON files like the one above; each JSON file represents one entry
  175. in the registry. To add a custom registry location, edit the
  176. <span class="ph filepath">config/configuration.properties</span> file in the DITA-OT installation directory and add the
  177. URL for your custom registry directory to the <code class="ph codeph">registry</code> key value, separating each entry with a
  178. space.</p>
  179. <div class="note tip note_tip"><span class="note__title">Tip:</span> Custom registry entries are a simple way to test your own plug-in entry file before submitting to
  180. a common registry.</div>
  181. </section>
  182. <section class="section" id="plugin-registry__testing-custom-registry"><h2 class="title sectiontitle">Testing with a custom registry</h2>
  183. <p class="p">To test your plug-in entry with a custom registry:</p>
  184. <ol class="ol">
  185. <li class="li">Fork the plug-in registry, which creates a new repository under your GitHub username — for example,
  186. <code class="ph codeph">https://github.com/USERNAME/registry.git</code>.</li>
  187. <li class="li">Create a new branch for your plug-in entry, and add the JSON file to the branch — for example, create
  188. <span class="ph filepath">org.example.newPlugin.json</span> in the branch <code class="ph codeph">addPlugin</code>.</li>
  189. <li class="li">As long as your repository is accessible, that branch now represents a working “custom registry” that can be
  190. added to the <span class="ph filepath">config/configuration.properties</span> file. Edit the <code class="ph codeph">registry</code> key
  191. and add the raw GitHub URL for the branch that contains the JSON file. With the example username and branch
  192. name above, you can add your registry
  193. with:<pre class="pre codeblock language-properties"><code>registry=https://raw.githubusercontent.com/USERNAME/registry/addPlugin/ http://plugins.dita-ot.org/</code></pre></li>
  194. <li class="li">You can now test the plug-in installation with:
  195. <pre class="pre codeblock"><code><span class="keyword cmdname">dita</span> <span class="keyword parmname">--install</span>=org.example.newPlugin</code></pre></li>
  196. <li class="li">Once you’ve confirmed that the entry works, you can submit a pull request to have your entry added to the
  197. common registry.</li>
  198. </ol>
  199. </section>
  200. </div>
  201. <nav role="navigation" class="related-links"><div class="familylinks"><div class="parentlink"><strong>Parent topic:</strong> <a class="link" href="../topics/custom-plugins.html" title="You can install or create DITA-OT plug-ins to change the default output types in various ways, add entirely new kinds of output formats, or implement DITA topic specializations.">Working with plug-ins</a></div></div><div class="linklist relinfo reltasks"><strong>Related tasks</strong><br><ul class="linklist"><li class="linklist"><a class="link" href="../topics/plugins-installing.html" title="Use the dita command to install a plug-in.">Installing plug-ins</a></li></ul></div></nav></article></main></body></html>