Here is an updated version of the wordfile for syntax highlighting Markdown files. I think, this one is a little better than yours. It is not perfect, but I think it is the best which can be done with current UltraEdit highlighting support as tested with UE v19.10 and should work also with UE v18.10.
Unfortunately highlighting an entire code block as (alternate) block comment is not working because of same strings used to define begin and end of a code block. That would be good not only for highlighting, but also for code folding. So just the first and last line of a code block is highlighted as line comment and code folding is not supported.
As function strings are defined UltraEdit regular expressions for finding headings 1 to 6. A grouped function string definition is used so that you have following choices by switching the options in context menu of the function list view:
- Grouped headings sorted alphabetically
by having Sort List enabled and Flat List not enabled.
- Grouped headings listed as occurring in the file
by having Sort List not enabled and Flat List not enabled.
- Grouped headings sorted alphabetically
by having Sort List enabled and Flat List not enabled.
- Headings listed as occurring in the file like document map in MS Word
by having Sort List not enabled and Flat List enabled.
- Headings listed alphabetically sorted
by having Sort List enabled and Flat List enabled.
I added open/close fold string definitions for headings using
Code: Select all
/Open Fold Strings = "#" "===="
/Close Fold Strings = "#" "===="
Adding
"----" is not good as such a string can exist also in tables. Code folding of everything between two headings is possible now with this fold strings. Code folding may work wrong if there are links containing a reference to an anchor as such links contain also
#. If that happens often, I suggest to change first open/close fold string from
"#" to
"##" which of course results in ignoring heading 1 for code folding.
The alternate headings 1 and 2 are recognized for syntax highlighting and function list only when having at least 4 characters. 3 characters could be also a horizontal rule and headings with just 1 or 2 characters are very unlikely. Please note that 4 or more
- in a table are highlighted also with color of heading 2. But I think, that is quite okay as
---- in a table marks a table header.