Blocks¶
Blocks
provide a structural division of MyST documents using +++
.
There can be optional metadata associated with the block, such as “tags”, “parts” or other identifiers.
This is used to attach attributes to chunks of content, or to break your page into cells for a Jupyter Notebook.
Document parts¶
You can use blocks to split your document into parts. See In a Jupyter Notebook cells and blocks for more information.
Page Breaks¶
You may use block
metadata to insert page breaks into your PDF or docx export with +++ { "page-break": true }
. This will have no impact on your MyST site build nor other static exports that disregard “pages” (e.g. JATS).
Add classes to blocks¶
You may attach CSS classes to blocks in order to control their behavior. The default MyST
div
and span
elements¶
You can add div
and span
elements to serve a similar purpose.
Any classes and content that you add will be attached to the AST of your document.
For example, here’s a div that uses the HTML theme grid classes to snap a div to the right:
:::{div}
:class: col-gutter-right
I'm off to the right!
:::
I’m off to the right!
Comments¶
You may add comments by putting the %
character at the beginning of a line. This will prevent the line from being shown in the output document.
Comments split paragraphs
Putting a comment between items will split any preceding elements. For example, a comment between two lines of text will be broken up into two paragraphs, resulting in a margin between them: