Skip to content

Feature Request: Wrap all <p>s after a header inside a <div> #1267

Description

@sudo-nano

I'm currently trying to use CSS to indent my paragraphs to all match the indentation level of the most recent header. As far as I can tell, this is impossible without containing them in a div, since there are not specific enough CSS selectors to do it otherwise.

Current behavior is that this markdown:

## heading 2
text 1 

text 2

### heading 3 
text 3

text 4

gets turned into this HTML:

<h2>heading 2</h2>
    <p>text 1</p>
    <p>text 2</p>
<h3>heading 3</h3>
    <p>text 3</p>
    <p>text 4</p>

I would like it to turn the above markdown into the following HTML:

<h2>heading 2</h2>
    <div>
        <p>text 1</p>
        <p>text 2</p>
    </div>
<h3>heading 3</h3>
    <div>
        <p>text 3</p>
        <p>text 4</p>
    </div>

so that the reasonable task of having text follow the indent of your markdown headers could be accomplished with simple CSS:

h2, h2 + div {
    text-indent: 20px;
}
h3, h3 + div {
    text-indent: 40px;
}
/* repeat for remaining headers */

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions