Gretyl's Portal

Heretto Help

Show Page Sections

Source Editor Overview

The Source Editor is a tool used to view DITA topics and maps in their source language. The Source Editor enables advanced DITA authors to edit with more precision. To help you navigate the code, the Source Editor colors syntax and your cursor position with a gray line in the scroll bar. While some content may have a preview, knowledge of the code is recommended.

Note: Only users with authoring permissions can edit using the Source Editor. Users without this permission can view the code only.
Important:

If multiple users collaborate on a resource, Heretto CCMS places a collaboration lock on the topic and the XML code is not editable.

Map XML Code

Heretto CCMS enables you to edit the map XML source in the Source Editor.

Figure 1. Map Source Editor.

You click Save to save your changes and close the Edit Source window.

Source Editor Window is open and shows a simple map structure.

Topic XML Code

The Source Editor enables you to edit the topic XML source side-by-side with the user-friendly editor rendering.

Figure 2. Topic Source Editor.

You can click Save to save the file and preview your changes. You can also click Save & Close to save the file and go back to the Content Editor. You can also click Cancel and go back to the Content Editor without saving the changes.

Source Editor Window is open and shows the source code for a simple concept topic.

OpenAPI Code

Heretto CCMS enables you to edit the OpenAPI code saved in a JSON file in the Source Editor.

Figure 3. OpenAPI Code Editor
OpenAPI in the Source Editor

Markdown Code

Heretto CCMS enables you to edit the Markdown code in the Source Editor.

Figure 4. Markdown Code Editor
Markdown code opened in the Source Editor.

XML Code Validation

The Source XML Invalid window appears if Heretto CCMS detects that something is wrong with the XML code that you edited.

Figure 5. Invalid XML Notification
Source Code Validation window warns the user that the changes they introduced resulted in validation errors.
Important: We recommend fixing the invalid XML files immediately because they may result in severe publishing errors. The Invalid XML code is indicated by a red underline and a red rectangle in the scroll bar.

If you plan to fix the invalid XML code later and you don't want to lose your changes, you can save the invalid XML code. Heretto CCMS notifies you about invalid XML files by displaying the Invalid File icon in the Content Library.

XML Code Autocompletion

Heretto CCMS suggests and automatically completes new XML elements for you.

You can quickly add an XML element by starting to enter the XML element code and selecting the relevant option from the Autocomplete menu. In the following example, the <se was typed and the Autocomplete menu suggested to insert a section element.

Figure 6. Autocomplete Menu
Source Editor Autocomplete Menu lets the user choose what element they want to insert; in this case it suggests the section element.

In the following example, the section element was selected from the Autocomplete menu. Heretto CCMS automatically closes the XML elements for you (in this example, the </section> closing tag was added).

Figure 7. Autocompleted XML Element
After the user selected the section element from the Autocompletion Menu the closing tag was automatically inserted..
Important:

If this feature is disabled for your organization, contact your Customer Success Manager.

XML Code Formatting

When you edit the XML code, it may become disorganized because you focus on writing and not formatting the code.

The following example shows a slightly disorganized piece of code in the Source Editor.

Figure 8. Non-Formatted XML Code
Source Editor showcases an example of a disorganized code.

You can make your code more readable by clicking the Format source . This makes Heretto CCMS automatically indent and position the code for you. It is useful if you don't want to waste your time on formatting the code on your own. The following example shows a code that was automatically formatted by Heretto CCMS.

Figure 9. Formatted XML Code
Source Editor showcases an example of formatted, organized code.

Find and Replace Code

The Source Editor enables you to quickly find and replace code.

With your cursor placed in the editor, you can press Ctrl > F (Windows) or Cmd > F (Mac) to open the Find dialog.

Figure 10. Find Dialog
Find dialog.

You can set the search to:

  • Match case
  • Match whole words
  • Analyze a part of the file
  • Use regular expression

You can replace your search results with a particular expression. To do so, in the Find dialog, you click the Toggle Replace mode button that expands it to the Find and Replace dialog.

Figure 11. Find and Replace Dialog
Find and replace dialog.

You can replace all search results at once or do it one by one. All search results are highlighted.

Collapse and Expand Code

Some XML files may be very complex, especially if you view their source. Heretto CCMS enables you to collapse and expand elements in the Source Editor.

Collapsing some code parts enables you to focus on a given part of the code. By default, all elements are expanded when you open a file in the Source Editor. The following example shows a concept topic with every element expanded.

Figure 12. Expanded Elements
An example of a concept topic opened in the Source Editor with all elements expanded.

Imagine that you want to focus only on the first section element in this concept topic. You can collapse irrelevant elements to limit distractions and increase readability. The following example shows the same concept topic with some elements collapsed, in this case the second section element.

Figure 13. Collapsed Element
A concept topic opened in Source Editor with the second section element collapsed.