Skip to content

Commit a332d26

Browse files
committed
Adding simpletoc-include class for explicit headline rendering.
1 parent 4eebe7a commit a332d26

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

plugin.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,10 @@ function add_ids_to_blocks( $content ) {
271271
* @return bool The filtered value.
272272
*/
273273
$skip_in_wrapper = apply_filters( 'simpletoc_skip_in_wrapper', true );
274+
if ( strpos( $tag_classes, 'simpletoc-include' ) !== false ) {
275+
// If someone has added the simpletoc-include class, then don't skip it, regardless of wrapper.
276+
$skip_in_wrapper = false;
277+
}
274278
if ( $skip_in_wrapper ) {
275279
// Try to get parent tag.
276280
$parent_tag = $tag->parentNode;
@@ -430,6 +434,10 @@ function filter_headings( $content ) {
430434
* @return bool The filtered value.
431435
*/
432436
$skip_in_wrapper = apply_filters( 'simpletoc_skip_in_wrapper', true );
437+
if ( strpos( $tag_classes, 'simpletoc-include' ) !== false ) {
438+
// If someone has added the simpletoc-include class, then don't skip it, regardless of wrapper.
439+
$skip_in_wrapper = false;
440+
}
433441
if ( $skip_in_wrapper ) {
434442
// Try to get parent tag.
435443
$parent_tag = $tag->parentNode;

0 commit comments

Comments
 (0)