How to indent a few lines in Markdown markup?

后端 未结 22 752
予麋鹿
予麋鹿 2020-12-12 08:42

I want to write a few lines of text. They should be formatted normally except each line should start at the 6th column. I.e. I don\'t want the code block formatting rule to

22条回答
  •  生来不讨喜
    2020-12-12 09:05

    As pointed out by @AlexDupuy in the comments, definition lists can be used for this.

    This is not supported by all markdown processors, but is widely available: Markdown Guide - Definition Lists

    Term 1
    : definition 1
    : definition 2
    
    Term 2
    : definition 1
    : definition 2
    

    Renders as (html):

    Term 1
    definition 1
    definition 2
    Term 2
    definition 1
    definition 2

    Typically the DT is rendered in a heading-like format, and each DD is rendered as indented text beneath this.

    If you don't want a heading/term, just use a non-breaking space in place of the definition term:

     
    : This is the text that I want indented.  All text on the same line as the preceding colon will be included in this definition.
    : If you include a second definition you'll get a new line; potentially separated by a space. 
    Some inline HTML may be supported within this too, allowing you to create new lines without spaces. : Support for other markdown syntax varies; e.g. we can add a bullet list, but each one's wrapped in a separate definition term, so the spacing may be out. : - item 1 : - item 2 : - item 3

    You can see this in action by copy-pasting the above examples to this site: Stack Edit Markdown Editor

提交回复
热议问题