How to indent a few lines in Markdown markup?

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

    There's no way to do that in markdown's native features. However markdown allows inline HTML, so writing

          This will appear with six space characters in front of it
    

    will produce:

          This will appear with six space characters in front of it

    If you have control over CSS on the page, you could also use a tag and style it, either inline or with CSS rules.

    Either way, markdown is not meant as a tool for layout, it is meant to simplify the process of writing for the web, so if you find yourself stretching its feature set to do what you need, you might look at whether or not you're using the right tool here. Check out Gruber's docs:

    http://daringfireball.net/projects/markdown/syntax#html

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

    On gitlab.com a single en space (U+2002) followed by a single em space (U+2003) works decently.

    Presumably other repetitions or combinations of not-exactly-accounted-for space characters would also suffice.

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

    If you're working with bullet points, try this:

    <ul>
      <li>Coffee</li>
      <li>Tea
        <ul>
          <li>Black tea</li>
          <li>Green tea</li>
        </ul>
      </li>
      <li>Milk</li>
    </ul>
    

    This is the method I use when styling markdown.

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

    Please use hard (non-breaking) spaces

    Why use another markup language? (I Agree with @c z above).
    One goal of Markdown is to make the documents readable even in a plain text editor.

    Same result two approaches

    The code

    Sample code
    &nbsp;&nbsp;&nbsp;&nbsp;5th position in an really ugly code  
        5th position in a clear an readable code  
        Again using non-breaking spaces :)
    

    The result

    Sample code
        5th position in an really ugly code
        5th position in a clear an readable code
        Again using non-breaking spaces :)

    The visual representation of a non-breaking space (or hard space) is usually a normal space " ", however, its Unicode representation is U+00A0.
    The Unicode representation of the ordinary space is U+0020 (32 in the ASCII Table).
    Thus, text processors may behave differently while the visual representation remains the same.

    Insert a hard space

    | OS        | Input method                      |
    |===========| ==================================|
    | macOS     | OPTION+SPACE (ALT+SPACE)          |
    | Linux     | Compose Space Space or AltGr+Space|
    | Windows   | Alt+0+1+6+0                       |
    
    Some text editor use Ctrl+Shift+Space.
    

    Issue

    Some text editors can convert hard spaces to common spaces in copying and pasting operations, so be careful.

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

    Check if you can use HTML with your markdown. Maybe this works out for you:

    • List entry one<br/>
      Indented line<br/>
      <br/>
      And some more..
    • Second entry
      • Subentry<br/>
        Hello there!
    0 讨论(0)
  • 2020-12-12 09:18

    This is an old thread, but I would have thought markdown's blockquotes ('> ') would be best for this:

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