You can set your help content to use the latest code samples from a repository, such as GitHub or BitBucket. Once set up, your HTML5 help will be able to update code samples automatically, without being republished.
Tip
For embedding Swagger/Open API code, see Embed Swagger OpenAPI.
Use dynamic code snippets to have your HTML5 output to use "live" code snippets from a repository.
-
Select Layout in the top menu.
-
Select the Layout you want to update or Create a Layout.
Tip
You can copy the URL of the Layout Editor and paste it into a new tab in your browser. This can be useful if you frequently switch between your Paligo content and the Layout settings.
-
Select Classes and attributes in the sidebar.
-
Select Enable for Output 'role' attribute as class names.
-
Select Save.
-
Select the topic or component in the Content Manager to open it in the Editor.
-
Select the position where you want the code to appear.
-
Press Alt + Enter ⏎ (Windows) or Command ⌘ + Enter ⏎ (Mac) to display the Element Context Menu.
-
Add a code block element, either
programlisting
orscreen
. -
Select the
programlisting
orscreen
element in the topic. -
Add these attributes and values In the Element Attributes Panel:
-
role
attribute with the valueembedcode
-
xlink:href
attribute with the URL to the code snippet in your repository.
-
-
Optional: If you want or need fallback code for other output formats, add the code snippet in the
programlisting
orscreen
element as well. -
Select Save.
When you publish, your code will be fetched from the repository and will be automatically updated if that code changes.
Comments
0 comments
Article is closed for comments.