이 콘텐츠는 선택한 언어로 제공되지 않습니다.
Chapter 3. TechDocs add-ons
TechDocs add-ons are dynamic plugins that extend the functionality of the built-in TechDocs plugin. For example, you can use add-ons to report documentation issues, change text size, or view images in overlay in either the TechDocs Reader page or an Entity page.
The following table describes the TechDocs add-ons that are available for Red Hat Developer Hub 1.5:
| TechDocs Add-on | Package/Plugin | Description | Type |
|---|---|---|---|
|
|
| Select a portion of text on a TechDocs page and open an issue against the repository that contains the documentation. The issue template is automatically populated with the selected text. | Preinstalled |
|
|
| Customize text size on documentation pages by increasing or decreasing the font size with a slider or buttons. The default value for font size is 100% and this setting is kept in the browser’s local storage whenever it is changed. | External |
|
|
| Open images in a light-box on documentation pages, to navigate to multiple images on a single page. The image size of the light-box image is the same as the image size on the document page. Clicking the zoom icon increases the image size to fit the screen. | External |
The backstage-plugin-techdocs-module-addons-contrib plugin package exports both preinstalled and external add-ons supported by Red Hat to the TechDocs plugin. This plugin package is preinstalled on Red Hat Developer Hub and is enabled by default. If the plugin package is disabled, all of the TechDocs add-ons exported by the package as also disabled.
3.1. Installing and configuring a TechDocs add-on 링크 복사링크가 클립보드에 복사되었습니다!
TechDocs add-ons supported by Red Hat are exported to the TechDocs plugin by the`backstage-plugin-techdocs-module-addons-contrib` plugin package, which is preinstalled on Red Hat Developer Hub and enabled by default. The <ReportIssue /> add-on is part of the default configuration of this plugin package and comes ready to use in the TechDocs plugin.
You can install other supported TechDocs add-ons by configuring the`backstage-plugin-techdocs-module-addons-contrib` plugin package in the Red Hat Developer Hub ConfigMap or Helm chart, depending on whether you use the Operator or Helm chart for installation. If you want to customize your TechDocs experience beyond the functions of the supported add-ons, you can install third-party add-ons on your TechDocs plugin, including add-ons that you create yourself.
3.1.1. Installing and configuring an external TechDocs add-on using the Operator 링크 복사링크가 클립보드에 복사되었습니다!
You can use a dynamic plugin to import TechDocs add-ons into your TechDocs plugin. If you use the Red Hat Developer Hub Operator to install the dynamic plugin, you can add TechDocs add-ons to the plugin package in your ConfigMap.
Preinstalled add-ons, such as ReportIssue, are included in the default backstage-plugin-techdocs-module-addons-contrib package configuration. External add-ons that are supported by Red Hat are installed by manually adding them to the techdocsAddons section of the configuration file.
Procedure
- From the Developer perspective in the OpenShift Container Platform web console, click ConfigMaps > Create ConfigMap.
- From the Create ConfigMap page, select the YAML view option in the Configure via field.
In the newly created ConfigMap, add the default
backstage-plugin-techdocs-module-addons-contribpackage configuration. For example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow In the
techdocsAddonssection of the ConfigMap, addimportName: <external_techdocs_add-on>for each external TechDocs add-on that you want to add from the specified plugin package. For example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow where:
- <external_techdocs_add-on>
-
Specifies the external TechDocs add-on that you want to install, for example,
TextSizeorLightBox.
- Click Create.
- In the web console navigation menu, click Topology.
- Click on the overflow menu for the Red Hat Developer Hub instance that you want to use and select Edit Backstage to load the YAML view of the Red Hat Developer Hub instance.
In your
BackstageCR, add thedynamicPluginsConfigMapName: <dynamic_plugins_configmap>key-value pair. For example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow where:
- <dynamic_plugins_configmap>
-
Specifies the name of your dynamic plugins ConfigMap for your Red Hat Developer Hub instance, for example,
dynamic-plugins-rhdh.
- Click Save.
- In the web console navigation menu, click Topology and wait for the Red Hat Developer Hub pod to start.
- Click the Open URL icon to start using the Red Hat Developer Hub platform with the new configuration changes.
3.1.2. Installing and configuring an external TechDocs add-on using the Helm chart 링크 복사링크가 클립보드에 복사되었습니다!
You can use a dynamic plugin to import TechDocs add-ons into your TechDocs plugin. If you use the Red Hat Developer Hub Helm chart to install the dynamic plugin, you can add TechDocs add-ons to the plugin package in your Helm chart.
Preinstalled add-ons, such as ReportIssue, are included in the default backstage-plugin-techdocs-module-addons-contrib package configuration. External add-ons that are supported by Red Hat are installed by manually adding them to the techdocsAddons section of the configuration file.
Prerequisites
- The TechDocs plugin is installed and enabled.
Procedure
In your Helm chart, add the
global.dynamicparameters required to install a dynamic plugin, as shown in Installing dynamic plugins using the Helm chartNoteThe default configuration includes the
dynamic-plugins.default.yamlfile, which contains all of the dynamic plugins, including TechDocs add-ons, that are preinstalled in Red Hat Developer Hub, whether they are enabled or disabled by default.In your Helm chart, add the default
backstage-plugin-techdocs-module-addons-contribpackage configuration. For example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow In the
techdocsAddonssection of the Helm chart, addimportName: <external_techdocs_add-on>for each external TechDocs add-on that you want to add from the specified plugin package. For example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow where:
- <external_techdocs_add-on>
-
Specifies the external TechDocs add-on that you want to install, for example,
TextSizeorLightBox.
3.1.3. Installing and configuring a third-party TechDocs add-on 링크 복사링크가 클립보드에 복사되었습니다!
You can install compatible third-party TechDocs add-on on your Red Hat Developer Hub instance as a front-end dynamic plugin.
Prerequisites
-
The third-party TechDocs add-on has a valid
package.jsonfile in its root directory, containing all required metadata and dependencies. - The third-party plugin is packaged as a dynamic plugin in an OCI image. For alternative package types, see Installing third-party plugins in Red Hat Developer Hub.
-
You have installed the
yarnpackage manager. - The third-party plugin is packaged as a dynamic plugin in an OCI image.* You have installed and configured Node.js and NPM.
Procedure
Install the third-party plugin that you want to use to import your third-party add-on by entering the following command:
yarn install
yarn installCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Obtain the source code for the third-party TechDocs add-on that you want to use.
Export the TechDocs add-on as a dynamic plugin using the following command:
npx @janus-idp/cli@latest package export-dynamic-plugin
npx @janus-idp/cli@latest package export-dynamic-pluginCopy to Clipboard Copied! Toggle word wrap Toggle overflow NoteThe
@latesttag pulls the latest version of the @janus-idp/cli package, which is compatible with the most recent features and fixes. Use a version that is compatible with your Red Hat Developer Hub version.To package the third-party TechDocs add-on as a dynamic plugin, navigate to the root directory where the plugin is stored (not the dist-dynamic directory) and run the
npxcommand with the--tagoption to specify the image name and tag. For example:npx @janus-idp/cli@latest package package-dynamic-plugins --tag quay.io/<user_name>/<techdocs_add-on_image>:latest
npx @janus-idp/cli@latest package package-dynamic-plugins --tag quay.io/<user_name>/<techdocs_add-on_image>:latestCopy to Clipboard Copied! Toggle word wrap Toggle overflow NoteThe output of the package-dynamic-plugins command provides the file path to the plugin for use in the
dynamic-plugin-config.yamlfile.To publish the third-party TechDocs add-on to a Quay repository, push the image to a registry using one of the following commands, depending on your virtualization tool:
To use
podman, enter the following command:podman push quay.io/<user_name>/<techdocs_add-on_image>:latest
podman push quay.io/<user_name>/<techdocs_add-on_image>:latestCopy to Clipboard Copied! Toggle word wrap Toggle overflow To use
docker, enter the following command:docker push quay.io/<user_name>/<techdocs_add-on_image>:latest
docker push quay.io/<user_name>/<techdocs_add-on_image>:latestCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Open your
dynamic-plugins.yamlfile to view or modify the configuration for the third-party TechDocs add-on. For example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow where
- <user_name>
- Specifies your Quay user name or organization name.
- <techdocs_add-on_image>
-
Specifies the name of the image for the third-party add-on that you want to use, for example,
mermaid. - <techdocs_add-on_package>
-
Specifies the , for example,
backstage-plugin-techdocs-addon-mermaid. - <third-party_add-on_name>
-
Specifies the name of the third-party add-on that you want to use, for example,
Mermaid. - <techdocs_add-on_property_key>
-
Specifies the name of the custom property that can be passed to the third-party add-on, for example,
themeVariables. Properties are specific to each add-on. You can list multiple properties for an add-on. - <techdocs_add-on_property_value>
-
Specifies the value of a property key for the third-party add-on, for example,
lineColor: #000000.
3.2. Removing a TechDocs add-on 링크 복사링크가 클립보드에 복사되었습니다!
Administrators can remove installed TechDocs add-ons from your Red Hat Developer Hub instance by using either the Operator or Helm chart, depending on the method used to install the add-on. If you used the Operator to install the add-on, remove it from the ConfigMap. If you used the Helm chart to install the add-on, remove it from the Helm chart.
If you want to disable a plugin instead of removing it from your Red Hat Developer Hub instance, you can disable the plugin that you are using to import the TechDocs add-on. Since the disabled status is controlled at the plugin level, disabling the plugin disables all of the TechDocs add-ons in the specified plugin package.
3.2.1. Removing an external TechDocs add-on from your ConfigMap 링크 복사링크가 클립보드에 복사되었습니다!
If you no longer want to use the functionality of a TechDocs add-on that is imported from a particular plugin that you installed on your Red Hat Developer Hub instance with the Operator, you can temporarily disable it or permanently remove it from your ConfigMap. The disabled status is controlled at the plugin level, therefore, disabling the plugin disables all of the TechDocs add-ons in the disabled plugin package.
Procedure
- From the Developer perspective in the OpenShift Container Platform web console, click ConfigMaps.
- From the ConfigMaps page, click the ConfigMap that contains the TechDocs add-on that you want to remove.
- Select the YAML view option in the Configure via field.
In the
pluginssection of the ConfigMap, do one of the following actions based on whether you want to disable or remove a TechDocs add-on:To temporarily disable all of the TechDocs add-ons in a particular plugin package, change the value of the
disabledfield totrue. For example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow where:
- <external_techdocs_add-on>
-
Specifies the external TechDocs add-on that you want to remove, for example,
TextSize.
To remove one or more TechDocs add-ons from your Red Hat Developer Hub instance, delete
importName: <external_techdocs_add-on>for each external TechDocs add-on that you want to remove from thetechdocsAddonssection of your ConfigMap. For example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow where:
- <external_techdocs_add-on>
-
Specifies the external TechDocs add-on that you want to remove, for example,
TextSize.
- Click Save.
- In the web console navigation menu, click Topology and wait for the Red Hat Developer Hub pod to start.
- Click the Open URL icon to start using the Red Hat Developer Hub platform with the new configuration changes.
3.2.2. Removing an external TechDocs add-on from your Helm chart 링크 복사링크가 클립보드에 복사되었습니다!
If you no longer want to use the functionality of a TechDocs add-on that is imported from a particular plugin that you installed on your Red Hat Developer Hub instance with the Helm chart, you can temporarily disable it or permanently remove it from your Helm chart. The disabled status is controlled at the plugin level, therefore, disabling the plugin disables all of the TechDocs add-ons in the disabled plugin package.
Procedure
In the
pluginssection of the Helm chart, do one of the following actions based on whether you want to disable or remove a TechDocs add-on:To temporarily disable all of the TechDocs add-ons in a particular plugin package, change the value of the
disabledfield totrue. For example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow where:
- <external_techdocs_add-on>
-
Specifies the external TechDocs add-on that you want to remove, for example,
TextSize.
To remove one or more TechDocs add-ons from your Red Hat Developer Hub instance, delete
importName: <external_techdocs_add-on>for each external TechDocs add-on that you want to remove from thetechdocsAddonssection of your Helm chart. For example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow where:
- <external_techdocs_add-on>
-
Specifies the external TechDocs add-on that you want to remove, for example,
TextSize.
3.3. Using TechDocs add-ons 링크 복사링크가 클립보드에 복사되었습니다!
After an administrator installs a TechDocs add-on in your Red Hat Developer Hub instance, you can use it to extend the functionality of the TechDocs plugin and enhance your documentation experience.
3.3.1. Using the ReportIssue TechDocs add-on 링크 복사링크가 클립보드에 복사되었습니다!
If you find an error in your organization’s TechDocs documentation, you can use the ReportIssue add-on to open a new GitHub or GitLab issue directly from the documentation. ReportIssue automatically imports the text that you highlight in the document into a new issue template in your repository.
Prerequisites
-
The
ReportIssueadd-on is installed and enabled in your TechDocs plugin. - You have permissions to create issues in the repository where documentation issues are reported.
Procedure
- In your TechDocs documentation, highlight the text that you want to report an issue for.
-
Click the text in the
ReportIssuebox, for example, Open new GitHub issue. From the new issue page in your repository, use the template to create the issue that you want to report.
NoteThe default issue title is Documentation feedback: <highlighted_text>, where <highlighted_text> is the text that you highlighted in your TechDocs documentation.
In the issue description, <highlighted_text> is the default value for the The highlighted text field.
Verification
- The issue that you created is listed on the issues page in your repository.
3.3.2. Using the TextSize TechDocs add-on 링크 복사링크가 클립보드에 복사되었습니다!
You can use the TextSize add-on to change the size of the text on either the TechDocs Reader page or an Entity page.
Prerequisites
-
The
TextSizeadd-on is installed and enabled in your TechDocs plugin.
Procedure
- In your TechDocs header, click the Settings icon.
Use the sliding scale to adjust the size of your documentation text.
Note- The default text size is 100%
- The minimize text size is 90%
- The maximum text size is 150%
3.3.3. Using the LightBox TechDocs add-on 링크 복사링크가 클립보드에 복사되었습니다!
If your TechDocs documentation contains an image, you can use the LightBox add-on to view an enlarged version of the image in a lightbox, or overlay window. You can also zoom to change the size the lightbox image. If a single documentation page contains multiple images, you can navigate between images in the lightbox.
Prerequisites
-
The
LightBoxadd-on is installed and enabled in your TechDocs plugin.
Procedure
- In your TechDocs documentation, click on the image that you want to view in a lightbox.
In the lightbox, you can do any of the following actions:
- Click the image or scroll to zoom in or zoom out.
- Click the arrow to navigate between images.
3.4. Creating a TechDocs add-on 링크 복사링크가 클립보드에 복사되었습니다!
If your organization has documentation needs that are not met by the functions of existing TechDocs add-ons, developers can create a new add-on for your TechDocs plugin.
A TechDocs add-on is a React component that is imported from a front-end plugin. If you do not have an existing plugin that you can use to export your TechDocs add-on, you can create a new plugin by using backstage-cli to generate a default front-end plugin structure that you can customize.
The folder structure of a new plugin that can be used to import TechDocs add-ons into the TechDocs plugin looks similar to the following example:
Prerequisites
-
The
yarnpackage manager is installed. - Docker v3.2.0 or later or Podman v3.2.0 or later is installed and running.
Procedure
- In the terminal, navigate to the root folder of the repository where you want to create your new plugin.
To create a new front-end plugin, run the following command:
yarn new
yarn newCopy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
? What do you want to create? plugin - A new frontend plugin ? Enter the ID of the plugin [required]
? What do you want to create? plugin - A new frontend plugin ? Enter the ID of the plugin [required]Copy to Clipboard Copied! Toggle word wrap Toggle overflow In the terminal prompt, type a name for the new plugin. For example:
? Enter the ID of the plugin [required] <new_plugin_for_techdocs_add-on>
? Enter the ID of the plugin [required] <new_plugin_for_techdocs_add-on>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
Successfully created plugin
Successfully created pluginCopy to Clipboard Copied! Toggle word wrap Toggle overflow Result
In the
pluginsdirectory, a sub-directory with the same name that you gave to your plugin is automatically generated. The directory contains all of the files that you need to configure to create your new plugin.In the terminal, navigate to your new plugin directory. For example:
cd plugins/<new_techdocs_add-on_directory>
cd plugins/<new_techdocs_add-on_directory>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add the`@backstage/plugin-techdocs-react` package to get frontend utilities for TechDocs add-ons. For example:
yarn add @backstage/plugin-techdocs-react
yarn add @backstage/plugin-techdocs-reactCopy to Clipboard Copied! Toggle word wrap Toggle overflow -
In the directory containing the components of your custom TechDocs add-on, delete any default files or file components that are not required for your add-on, such as the
routes.tsfile or components of theindex.tsxandplugins.tsfiles. In the
plugins.tsfile, add the following code:Copy to Clipboard Copied! Toggle word wrap Toggle overflow where
- <new_plugin_for_techdocs_add-on>
- Specifies the new plugin that you use to import the TechDocs add-on to your Red Hat Developer Hub instance.
- <new_techdocs_add-on>
- Specifies the custom TechDocs add-on that you want to create.
- <new_techdocs_addon_props> (Optional)
-
Specifies the
propsfor your new TechDocs add-on, as specified in your<new_techdocs_add-on>.tsxfile, if applicable. - <new_techdocs_add-on_component>
-
Specifies the React component for the custom TechDocs add-on that you want to create. You will create this component in a
.tsxfile in a later step.
In the
index.tsfile, export the custom TechDocs add-on that you want to create by adding the following code:export { <new_plugin_for_techdocs_add-on>, <new_techdocs_add-on> } from './plugin';export { <new_plugin_for_techdocs_add-on>, <new_techdocs_add-on> } from './plugin';Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Create a new
<new_techdocs_add-on>.tsxfile and add the code for your new TechDocs add-on component. Create a new
index.tsxfile and use it to export your new TechDocs add-on component by adding the following code:export { <new_techdocs_add-on>, type <new_techdocs_addon_props>} from './<new_techdocs_add-on_directory>'export { <new_techdocs_add-on>, type <new_techdocs_addon_props>} from './<new_techdocs_add-on_directory>'Copy to Clipboard Copied! Toggle word wrap Toggle overflow where
- <new_techdocs_addon_props> (Optional)
-
Specifies the
propsfor your new TechDocs add-on, as specified in your<new_techdocs_add-on>.tsxfile, if applicable.
-
In the
plugins.tsfile, import your new TechDocs add-on component. - Install and configure your new TechDocs add-on by following the steps in Installing and configuring a TechDocs add-on
Verification
- Restart the RHDH application and verify that the plugin is successfully activated and configured.
- Verify the application logs for confirmation and ensure the plugin is functioning as expected.