Kramdown tez, sof Ruby Markdown-superset konvertori
Download 272.25 Kb.
|
Sintaksis Kramdown
HTML tags cannot only be used on the block-level but also on the span-level. Span-level HTML tags can only be used inside one block-level element, it is not possible to use a start tag in one block level element and the end tag in another. Note that only correct XHTML is supported! This means that you have to use, for example, /> instead of (although kramdown tries to fix such errors if possible). By default, kramdown parses kramdown syntax inside span HTML tags. However, this behaviour can be configured with the parse_span_html option. If this is set to true, then syntax parsing in HTML spans is https://kramdown.gettalong.org/syntax.html 22/29 07.05.2023, 19:42 Sintaksis | Kramdown enabled, if it is set to false, parsing is disabled. It is also possible to enable/disable syntax parsing on a tag per tag basis using the markdown attribute: If an HTML tag has an attribute markdown="0", then no parsing (except parsing of HTML span tags) is done inside that HTML tag. If an HTML tag has an attribute markdown="1", then the content of the tag is parsed as span level elements. If an HTML tag has an attribute markdown="block", then a warning is issued because HTML spans cannot contain block-level elements and the attribute is ignored. If an HTML tag has an attribute markdown="span", then the content of the tag is parsed as span level elements. The content of a span-level HTML tag is normally parsed as span-level elements. Note, however, that some tags like are not parsed, i.e. their content is not modified. XML comments can also be used (their content is not parsed). However, as with HTML tags the start and the end have to appear in the same block-level element. Span-level XML comments as well as general span-level HTML and XML tags have to be preceded by at least one non whitespace character on the same line so that kramdown correctly recognizes them as span-level element and not as block-level element. However, all span HTML tags, i.e. a, em, b, …, (opening or closing) can appear at the start of a line. Unclosed span-level HTML tags are correctly closed at the end of the span-level text to ensure correct nesting and invalidly used end tags or block HTML tags are removed from the output: This is This is automatically closed. This is . This is automatically closed. Also note that one or more consecutive new line characters in an HTML span tag are replaced by a single space, for example: Link: href="some link">text Link: href="some link">text Footnotes This syntax feature is not part of the original Markdown syntax. The idea and syntax comes from the PHP Markdown Extra package. Footnotes in kramdown are similar to reference style links and link definitions. You need to place the footnote marker in the correct position in the text and the actual footnote content can be defined anywhere in the document. More exactly, a footnote marker can be created by placing the footnote name in square brackets. The footnote name has to start with a caret (^), followed by a word character or a digit and then optionally followed by other word characters, digits or dashes. For example: This is some text.[^1]. Other text.[^footnote]. https://kramdown.gettalong.org/syntax.html 23/29 07.05.2023, 19:42 Sintaksis | Kramdown Note that footnote markers cannot be used as part of the link text of a link because this would lead to nested links which is not allowed in HTML. Footnote markers with the same name will link to the same footnote definition. The actual naming of a footnote does not matter since the numbering of footnotes is controlled via the position of the footnote markers in the document (the first found footnote marker will get the number 1, the second new footnote marker the number 2 and so on). If there is a footnote definition found for the identifier, a footnote will be created. Otherwise the footnote marker is not converted to a footnote link. Also note that all attributes set via a span IAL are ignored for a footnote marker! A footnote definition is used to define the content of a footnote and has the following structure: The footnote name in square brackets, optionally indented up to three spaces, then a colon and one or more optional spaces, then the text of the footnote and optionally more text on the following lines which have to follow the syntax for standard code blocks (the leading four spaces/one tab are naturally stripped from the text) Footnote definitions are, despite being described here, non-content block-level elements. The whole footnote content is treated like block-level text and can therefore contain any valid block-level element (also, any block-level element can be the first element). If you want to have a code block as first element, note that all leading spaces/tabs on the first line are stripped away. Here are some example footnote definitions: [^1]: Some *crazy* footnote definition. [^footnote]: > Blockquotes can be in a footnote. as well as code blocks or, naturally, simple paragraphs. [^other-note]: no code block here (spaces are stripped away) [^codeblock-note]: this is now a code block (8 spaces indentation) It does not matter where you put a footnote definition in a kramdown document; the content of all referenced footnote definitions will be placed at the end of the kramdown document. Not referenced footnote definitions are ignored. If more than one footnote definitions have the same footnote name, all footnote definitions but the last are ignored. Although footnote definitions are non-content block-level elements, block IALs can be used on them to attach attributes. How these attributes are used depends on the converter. Download 272.25 Kb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling