Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add a cssSelector configuration parameter RevealHighlight #3563

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

Conversation

TendTo
Copy link

@TendTo TendTo commented Jan 28, 2024

This functionality is inspired by the highlight.js library'configuration.

While the standard "pre-code" selector works fine in most cases, there may be instances where the user may want more control over what elements the plugin will affect. This solution provides a very easy way to be more selective.

The documentation would need to be updated to account for this new option.

While in most cases the standard "pre code" selector works fine, there may be instances where the user may want more control on what elements will be affected by the plugin. This solution provides a very easy way to be more selective while being completely non-breaking
Plugin.highlightBlock( block );
} );
}

// If we're printing to PDF, scroll the code highlights of
// all blocks in the deck into view at once
reveal.on( 'pdf-ready', function() {
[].slice.call( reveal.getRevealElement().querySelectorAll( 'pre code[data-line-numbers].current-fragment' ) ).forEach( function( block ) {
[].slice.call( reveal.getRevealElement().querySelectorAll( config.cssSelector + '[data-line-numbers].current-fragment' ) ).forEach( function( block ) {
Copy link
Author

Choose a reason for hiding this comment

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

This line makes sense only for compatible modifications to the selector.
If you wanted to give complete control to the user, a new configuration would need to be added. Something like

config.cssSelectorLineNumbers = typeof config.cssSelectorLineNumbers === 'string' ? config.cssSelectorLineNumbers : 'pre code[data-line-numbers].current-fragment';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant