How to indent a few lines in Markdown markup?

后端 未结 22 629
予麋鹿
予麋鹿 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:01

    For quoted/indented paragraphs this hack might work (depending on render engine):

    | | | |
    |-|-|-|
    |  | _"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."_ | |
    |
    

    which renders as:

    0 讨论(0)
  • 2020-12-12 09:02

    Okay, with a little HTML in your R code, I did the following code to generate pure text in R Markdown. The <h3 style="text-indent: 15em;"> indents the text 15 spaces. For the original question, change the 15 to 6.

    ## Option: Du Pont Ratio Concept - (ROE Decomposition)
    ### (Closed Quotes/Total Premium) = (Closed Quotes/Quotes Issued) X <br>
    <h3 style="text-indent: 15em;">
     (Quotes Issued/Renewal Premium) X <br></h3>
    <h3 style="text-indent: 15em;">
     (Renewal Premium/Total Premium)</h3>
    

    So the resulting code gives my desired output format. I am using tabs for the Markdown document and was looking to line up the () text which worked.

    0 讨论(0)
  • 2020-12-12 09:03

    do tab, then the + sign, then space, then your content

    So

    * level one + level two tabbed

    0 讨论(0)
  • 2020-12-12 09:04

    What about place a determined space in the start of paragraph using the math environment as like:

    $\qquad$ My line of text ...

    This works for me and hope work for you too.

    0 讨论(0)
  • 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):

    <dl>
        <dt>Term 1</dt>
        <dd>definition 1</dd>
        <dd>definition 2</dd>
        <dt>Term 2</dt>
        <dd>definition 1</dd>
        <dd>definition 2</dd>
    </dl>
    

    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:

    &nbsp;
    : 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. <br />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

    0 讨论(0)
  • 2020-12-12 09:05

    Another alternative is to use a markdown editor like StackEdit. It converts html (or text) into markdown in a WYSIWYG editor. You can create indents, titles, lists in the editor, and it will show you the corresponding text in markdown format. You can then save, publish, share, or download the file. You can access it on their website - no downloads required!

    0 讨论(0)
提交回复
热议问题