Advanced - HTML
Text written in KARAS can include HTML. In many cases, KARAS outputs the appropriate result, but if the result is different from that you think, you can write HTML directly. This page describe rules about HTML.
In few system, because of the security or output format, you may not able to insert HTML.
- Easiest Sample
- Text beginning with <
- Blank line in HTML
- Wrong Usage
- < and > mark in pre, code, samp element
For example, you can write HTML like this.
Like a following sample, you can write HTML in KARAS syntax, and also can write KARAS in HTML.
Text beginning with <
Text beginning with single
< is regarded as HTML text. HTML text does not become a paragraph. Note, even if the text beginning with single
< is not HTML tag, it does not become a paragraph. Usually, < and > mark is written in Character Reference like
For example, when you write a text beginning with mark element, it does not become a paragraph.
Text following after the mark element is not closed with HTML element, so this output result(HTML) has wrong structure.
In order to solve this problem, to write a
\ to escape, or, to write a correct HTML element directly. In here, p element.
Note, KARAS syntax in the text which beginning with single
< is not converted. For example, like a sample, KARAS syntax is not converted and outputted directly. In here, sample shows case of p element, but the h1 or div element are also not converted.
In KARAS, paragraph is separated with blank line or other KARAS syntax. The 2nd line in the next sample is beginning with
<, the text becomes a paragraph. Because the 1st line of the text is start position of the paragraph.
Inline group syntax using
<< is not regarded as HTML, and converted. Text in following sample becomes a paragraph.
Blank line in HTML
Be careful when the blank line is included in HTML. KARAS divide a text with blank line. For example, when you write a text like a following sample, the output result has wrong structure.
Because there is a text beginning with blank line, KARAS convert the text to p element. In HTML, p element can not include other p element. So this result has wrong structure. This problem is not only to p element. All of HTML element which can not include p element has this problem.
On the other hand, by using this rule, it is able to put KARAS syntax and the p element into HTML. For example, text in following sample becomes a correct result.
When using combination of KARAS and HTML, be careful with wrong usage like following case. When you write a HTML, it is important to have correct knowledge about HTML.
Case - 1
Because of the HTML text in KARAS document, outputted HTML may gets wrong structure. For example, following text has wrong.
In HTML, h1-6 element can not include h1-6 element. Therefore, this HTML has wrong structure.
Case - 2
KARAS regards continuous text as one block. Sometimes HTML elements are included in the block.
Therefore, for example, be careful to not include HTML element which can not be included in p element into p element (paragraph). Following text has wrong structure. p element (paragraph) can not include ul element.
To solve this problem, insert blank line before the ul element.
Case - 3
There are also some pattern that can not be combined with HTML and KARAS syntax. For example, when you write a list, like a following sample. It looks like 2 li elements are included in ul element, but the output result is not to be so.
In here, sample shows ul and li case, but this is same in case of table or the other.
< and > mark in pre, code, samp element
KARAS has group syntax to output pre, code, and samp element. < and > marks in these group are converted to character reference. However, when pre, code, and samp element is written in HTML directly, < and > marks in these element is not converted. And the KARAS syntax in these element is also not converted.