Skip to content
This repository was archived by the owner on Mar 9, 2022. It is now read-only.

Conversation

@WolfeCub
Copy link

When using .org files as a content format each header generates a container around the text that follows it. Example:
image

Due to the way the styles and selectors are implemented currently this breaks header marks since they are required to be direct children of content.

I propose simply allowing any nested children of content that have headers to be given header marks.

}
}

> h2 > .header-mark::before {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @WolfeCub,

Can we use something like this?

   > h2,
   > h3,
   > h4,
   > h5,
   > h6,
   > .outline-text-2 > h2,
   > .outline-text-3 > h3,
   > .outline-text-4 > he,
   > .outline-text-5 > h5,
   > .outline-text-6 > h6,
 {
      > .header-mark::before {
        content: "|";
        margin-right: 0.3125rem;
      }
    }

I think it's more performant to use child selectors instead of the descendant selectors.

for (let num = 1; num <= 6; num++) {
this.util.forEach(
document.querySelectorAll(".single .content > h" + num),
document.querySelectorAll(".single .content h" + num),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the proposed before will work for you, we can add here the new selector:

document.querySelectorAll(`.single .content > h${num}, .single .content > .outline-text-${num} > h${num}`)

h2 > .header-mark::before {
content: "#";
}
> h3 > .header-mark::before {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the proposal will work, this would be the change:

> .outline-text-3 > h3 > .header-mark::before,
> h3 > .header-mark::before {
  /* ... */
}

@victor-pogor victor-pogor added the enhancement New feature or request label Sep 20, 2021
@victor-pogor victor-pogor changed the title Support content formats where headers aren't direct children of content fix(emacs-org): support content formats where headers aren't direct children of content Sep 20, 2021
@victor-pogor victor-pogor added this to the v0.3.0 milestone Sep 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants