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 <style scoped> to apply inline style to current page #85

Closed
yhatt opened this issue Oct 27, 2018 · 0 comments · Fixed by #94
Closed

Support <style scoped> to apply inline style to current page #85

yhatt opened this issue Oct 27, 2018 · 0 comments · Fixed by #94
Assignees
Labels
enhancement New feature or request

Comments

@yhatt
Copy link
Member

yhatt commented Oct 27, 2018

By default, the content of inline <style> is appended to the end of theme and would effect to whole of slide deck. It is useful for tweaking current theme, but we thought some people want to apply style only to current page.

Currently it could apply customized section CSS to single page by the combination with class spot directive.

<!-- _class: title -->

<style>
section.title h1 {
  text-align: center;
}
</style>

# Centered!

---

# Aligned to left

However, this way is a bit verbose. If you don't intend to re-use style, it may nice to be able writing scoped style to current page like this:

<style scoped>
h1 {
  text-align: center;
}
</style>

# Centered!

It would convert into scoped HTML and CSS. The scoping target is section element for slide page.

<section data-marpit-scope-d318a2c1>
  <h1>Centered!</h1>
</section>
section[data-marpit-scope-d318a2c1] h1 {
  text-align: center;
}

We would have to make it be able to change enable or disable in Marpit constructor. <style scoped> is already removed from the specification of HTML, and not supported on modern browsers. Nevertheless, this syntax is still favored in Vue component.

@yhatt yhatt added the enhancement New feature or request label Oct 27, 2018
@yhatt yhatt self-assigned this Oct 30, 2018
@yhatt yhatt closed this as completed in #94 Nov 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant