Customizing Text-to-Markup Shortcut Patterns
Some built-in frameworks include a configuration file that defines shortcut patterns that can
be used in Author mode to automatically insert a certain XML structure.
More specifically, the XML structure (fragment) automatically replaces a specific prefix
pattern. For example, if you are editing a DITA document using the built-in DITA framework,
entering a hyphen (-) followed by a space at the beginning of a paragraph would
automatically replace them with an unordered list element (<ul>
) with a
child list item element (<li>
). This is made possible by the
AutoCorrect mechanism in Oxygen XML Author.
- Create a new resources folder (if it does not already exist) in the frameworks directory for the particular document type (for example, OXYGEN_INSTALL_DIR/frameworks/dita/resources).
- Open the Preferences dialog box and go to Document Type Association. Select the particular document type, click the Edit button, and in the Classpath tab add a link to that resources folder (if it does not already exist).
- Create a new structureAutocorrect.xml file or edit an existing one (this file already exists in the resources folder of particular document types and you can use an existing file as a starting point for your customization).
-
Make the appropriate changes to your structureAutocorrect.xml file. The file should look like this:
<structure-autocorrect> <!-- Unordered lists --> <prefix-replacement prefix="-"> <ul><li/></ul> </prefix-replacement> <!-- Ordered lists --> <prefix-replacement prefix="1."> <ol><li/></ol> </prefix-replacement> <!-- Code block --> <prefix-replacement prefix="```"> <codeblock/> </prefix-replacement> </structure-autocorrect>
Using this example, when a user enters one of the defined prefixes at the start of an element that allows the corresponding fragment, Oxygen XML Author will automatically replace the prefix with its corresponding fragment. For example, entering a hyphen (-) at the beginning of a paragraph followed by a space would automatically replace them with an unordered list element (
<ul>
) with a child list item element (<li>
). Any subsequently added content would be placed inside the first node/element that does not have a child node/element (in this example, the cursor would be placed in the first<li>
element). - Save the file in the resources folder for the particular document type, using the fixed name: structureAutocorrect.xml (for example, OXYGEN_INSTALL_DIR/frameworks/dita/resources/structureAutocorrect.xml).
- Restart the application and open a document for your particular framework to test your
customization.Note: Once the file is created, changes that you make to it are processed by Oxygen XML Author when you press the Reload toolbar button.