Kramdown tez, sof Ruby Markdown-superset konvertori


Download 272.25 Kb.
bet3/10
Sana16.06.2023
Hajmi272.25 Kb.
#1506125
1   2   3   4   5   6   7   8   9   10
Bog'liq
Sintaksis Kramdown

Sarlavhalar

kramdown Setext uslubi va atx uslubi sarlavhalarini qo'llab-quvvatlaydi. Ikkala shakl ham bitta hujjat ichida ishlatilishi mumkin.

Matn uslubi

Setext uslubidagi sarlavhalar blok chegarasida matn qatori (sarlavha matni) va faqat teng belgilar (birinchi darajali sarlavha uchun) yoki tire (ikkinchi darajali sarlavha uchun) bo'lgan chiziq bilan boshlanishi kerak . Sarlavha matni uchta bo'shliqqa qadar chekinishi mumkin, lekin har qanday bosh yoki keyingi bo'shliqlar sarlavha matnidan olib tashlanadi. Teng belgilar yoki chiziqlar miqdori unchalik ahamiyatli emas, faqat bittasi kifoya qiladi, lekin ko'proq ko'rinishi mumkin. Teng belgilar yoki chiziqlar birinchi ustundan boshlanishi kerak. Masalan:

First level header ==================

Second level header ------

Other first level header =


Setext sarlavhalari blok chegaralarida boshlanganligi sababli, bu ko'p hollarda ular oldida bo'sh qator bo'lishi kerakligini anglatadi. Biroq, Setext sarlavhasidan keyin bo'sh satrlar kerak emas:

This is a normal paragraph.

And A Header ------------
And a paragraph

> This is a blockquote.

And A Header ------------

https://kramdown.gettalong.org/syntax.html 5/29
07.05.2023, 19:42 Sintaksis | Kramdown
Biroq, odatda, Setext sarlavhasidan keyin bo'sh qatorni qo'llash yaxshi fikrdir, chunki u yanada mosroq ko'rinadi va hujjatni o'qishni osonlashtiradi.


Asl Markdown sintaksisi Setext sarlavhasi oldidan bo'sh qatorni tashlab qo'yish imkonini beradi. Biroq, bu noaniqliklarga olib keladi va hujjatni o'qishni kerak bo'lgandan ko'ra qiyinlashtiradi. Shuning uchun kramdown hujjatida bunga ruxsat berilmaydi.


Ta'kidlash joizki, bir chekka holat quyidagilardir:

header ---para

Bu gorizontal qoida yoki ikkinchi darajali sarlavha va paragraf bilan ajratilgan ikkita paragrafni ifodalaydimi, degan savol tug'ilishi mumkin . Misoldagi so'zlar bilan taklif qilinganidek, ikkinchisi shunday. Umumiy qoida shundaki, Setext sarlavhalari gorizontal qoidalardan oldin qayta ishlanadi.

atx uslubi

atx uslubidagi sarlavhalar blok chegarasida bir yoki bir nechta xesh belgilarni o'z ichiga olgan chiziqdan va keyin sarlavha matnidan boshlanishi kerak . Xesh belgilaridan oldin bo'sh joylarga ruxsat berilmaydi. Xesh-belgilar soni sarlavha darajasini belgilaydi: bitta xesh-belgi sizga birinchi darajali sarlavhani, ikkita ikkinchi darajali sarlavhani va hokazolar oltinchi darajali sarlavha uchun maksimal oltita xesh-belgiga qadar davom etadi. Sarlavhani yopish uchun ixtiyoriy ravishda satr oxiridagi istalgan sonli xeshlardan foydalanishingiz mumkin. Har qanday oldingi yoki keyingi bo'shliqlar sarlavha matnidan olib tashlanadi. Masalan:

# First level header

### Third level header ###

## Second level header ######

Shunga qaramay, asl Markdown sintaksisi atx uslubidagi sarlavha oldidan bo'sh qatorni qoldirib ketishga imkon beradi.

Sarlavha identifikatorini belgilash

kramdown supports a nice way for explicitly setting the header ID which is taken from PHP Markdown Extra and Maruku: If you follow the header text with an opening curly bracket (separated from the text with a least one space), a hash, the ID and a closing curly bracket, the ID is set on the header. If you use the trailing hash feature of atx style headers, the header ID has to go after the trailing hashes. For example:

Hello {#id} -----

# Hello {#id}

# Hello # {#id}

This additional syntax is not part of standard Markdown.

Blockquotes

A blockquote is started using the > marker followed by an optional space and the content of the blockquote. The marker itself may be indented up to three spaces. All following lines, whether they are started with the blockquote marker or just contain text, belong to the blockquote because blockquotes support line wrapping.


The contents of a blockquote are block-level elements. This means that if you are just using text as content that it will be wrapped in a paragraph. For example, the following gives you one blockquote with two paragraphs in it:
https://kramdown.gettalong.org/syntax.html 6/29
07.05.2023, 19:42 Sintaksis | Kramdown
> This is a blockquote. > on multiple lines that may be lazy.
>
> This is the second paragraph.

Since the contents of a blockquote are block-level elements, you can nest blockquotes and use other block-level elements (this is also the reason why blockquotes need to support line wrapping):

> This is a paragraph. >
> > A nested blockquote. >
> ## Headers work >
> * lists too >
> and all other block-level elements

Note that the first space character after the > marker does not count when counting spaces for the indentation of the block-level elements inside the blockquote! So code blocks will have to be indented with five spaces or one space and one tab, like this:

> A code block: >
> ruby -e 'puts :works'

Line wrapping allows one to be lazy but hinders readability and should therefore be avoided, especially with blockquotes. Here is an example of using blockquotes with line wrapping:

> This is a paragraph inside a blockquote.
>
> > This is a nested paragraph that continues here
> and here
> > and here

Code Blocks

Code blocks can be used to represent verbatim text like markup, HTML or a program fragment because no syntax is parsed within a code block.


Download 272.25 Kb.

Do'stlaringiz bilan baham:
1   2   3   4   5   6   7   8   9   10




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling