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

Support CSS scoping by element id #57

Merged
merged 2 commits into from
Aug 26, 2018
Merged

Support CSS scoping by element id #57

merged 2 commits into from
Aug 26, 2018

Conversation

yhatt
Copy link
Member

@yhatt yhatt commented Aug 26, 2018

This PR will support CSS scoping by element id.

On ThemeSet#pack, Marpit's container and slideContainer have been used to genearte a scoped CSS selector. It supports scoping by class attribute, but sometimes you might want higher specificity.

We will improve PostCSS pseudo selector replace plugin to recognize id attribute.

const container = new Element('div', { id: 'container' })
const { css } = new Marpit({ container }).render('# Markdown')
/* Internal pseudo selector */
:marpit-container > :marpit-slide { background: #fff; }

/* After convert */
div#container > section { background: #fff; }

This feature might use in @marp-team/marp-cli's bespoke template.

@yhatt yhatt merged commit 366518a into master Aug 26, 2018
@yhatt yhatt deleted the id-scoping branch August 26, 2018 15:33
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.

1 participant