is a lightweight markup language for creating formatted text.
We implemented Markdown export in TRichView 18.x, and now we implemented Markdown import.
TRichView has the following new methods:
The following content can be imported:
- paragraphs and headings with formatted text
- code blocks (as paragraph of a special style)
- block quotes (as paragraphs of a special style, a level of nesting is shown by left indents)
- multilevel bullets and numberings
- thematic breaks
Paragraphs may contain the following formatting: emphasis, strong emphasis, code spans.
Documents may contain images (from external sources) and hyperlinks.
TRichView follows CommonMark Markdown Specification
All Markdown syntax is supported, except for HTML tags. Only two of them are processed: <br> creates a line break, <!-- HTML comments --> are discarded (well, there are undocumented events to process other HTML tags, contact me if you are interested).
Appearance of the imported document depends on the mode of using styles (StyleTemplates).
If named styles (StyleTemplates) are used, they are applied. For example, block quote paragraphs are formatted using "Quote" style, emphasized text is formatted using "Emphasis" style, etc.
Otherwise, some default formatting is used (such as italic for emphasized text).
Tables are not included in the standard Markdown specification, however, there is a widely used Markdown extension (for example, it is used in GitHub Flavored Markdown
TRichView supports both import and export of tables in Markdown.
Differences between Markdown import and export in TRichView
Not every Markdown content can be represented in TRichView as it is.
For example, in TRichView, list items are paragraphs, while in Markdown they may contain subdocuments.
When importing, TRichView uses indents to show level of nesting of list items and block quotes. As a result, everything looks like it was designed, but the internal structure is different. On export, only single paragraphs belong to each list item, and only a single level of block quotes can be exported.
Also, the current version of TRichView does not support export of code blocks and code spans (it will be implemented in future updates).
Also, a footnote Markdown extension is currently supported only on export (import will be implemented in future updates)
Other methods supporting Markdown
is the method that detects a format for loading. It can detect RTF, RVF, DocX. Now, if none of these formats is detected, you can choose from loading the stream as a text or as a Markdown.