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

fix(emacs-org): support content formats where headers aren't direct children of content #281

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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.

@@ -113,16 +113,16 @@
}
}

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

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.

@@ -534,7 +534,7 @@ class Theme {
initHeaderLink() {
for (let num = 1; num <= 6; num++) {
this.util.forEach(
document.querySelectorAll(".single .content > h" + num),
document.querySelectorAll(".single .content h" + num),
Copy link
Member

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}`)

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

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.

None yet

2 participants