Indent first line of paragraph

Hey there,

I saw a couple of questions how to indent text so I wanted to share my solution with you.

I wanted this:

  • don’t indent headings, quotes
  • indent first line of paragraph
  • don’t indent first line of first paragraph after heading, quotes

Step 1

  • add “indent” as CSS class with the new properties feature

Step 2

  • create your custom CSS snippet:
/* TEXT INDENT */

/* regular indent */
.indent .cm-content .cm-line {
    text-indent: 1.5rem;
}

/* no indent for header */
.indent .cm-content .HyperMD-header {
    text-indent: 0;
}

.indent .cm-content .HyperMD-header+.cm-line,
.indent .cm-content .HyperMD-quote+.cm-line {
    text-indent: 0;
    /* background-color: blue; */
}

.indent .cm-content .HyperMD-header+.cm-line+.cm-line,
.indent .cm-content .HyperMD-quote+.cm-line+.cm-line {
    text-indent: 0;
    /* background-color: red; */
}

(if you want you can uncomment the colors red and blue to see what it does)

Hope this helps :slight_smile:


2 Likes