CSS fails to hide the header of an embedded heading when exporting [test in 1.8.7]

Hi all! I used the following CSS to hide the header of an embedded heading (![[note#heading]]) in previous versions. But in the recent versions, the headers still show up on export. Is there a way to modify this CSS?

.markdown-embed .mod-header+ div > :is(h1, h2, h3, h4, h5, h6) {
  display: none;
}

Test text:

![[#test]]

## test

1

Expected outcome:

image

Actual outcome in PDF:

image

What have tried

  • Search the forum.
  • Add .print CSS selector.
  • Add !important.
  • Change the selector to :is(.el-h2).

Give this a try:

.internal-embed :is(h1, h2, h3, h4, h5, h6) {
    display: none;
}

Hi @ariehen Thanks for your reply. The problem with the CSS you provided is that if you directly select from h1 to h6, when you embed a heading, all headings under the embedded one will be hidden. For example, if you embed a second-level heading with a third-level heading under it, you are supposed to only hide the second-level one while keeping the rest. But if you select all, the third-level heading will also disappear.

Still, it’s better than having no response at all as before. Maybe this is the right way. I’ll try in this direction.

Test text:

![[#test]]

## test

text between head and subhead

### subhead

1

Ah! Gotcha.

To be honest I just checked quick if it worked (generally) in PDF exports or not. I’ll have a look again later if I have time. :slightly_smiling_face:

.internal-embed {
  .print & :first-child:is(h1, h2, h3, h4, h5, h6),
  & .mod-header+ div > :is(h1, h2, h3, h4, h5, h6) {
    display: none;
  }
}

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.