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

Questions about theming #134

Closed
melck opened this issue Dec 4, 2019 · 5 comments
Closed

Questions about theming #134

melck opened this issue Dec 4, 2019 · 5 comments

Comments

@melck
Copy link

melck commented Dec 4, 2019

Hello

I have a made a custom theme and now i want to have a theme that support multiple size (4:3 16:9 4K A4) with completely different css rules for size A4.

Do you have a class applied when size is setup ?

@yhatt yhatt added the question Not issue, just a question label Dec 5, 2019
@yhatt
Copy link
Member

yhatt commented Dec 5, 2019

There is no applied class even if setting up size global directive at the moment. Marpit local directives are assigned data attributes (data-xxx="xxx") and CSS variables to <section> elements, but global directives are not.

As my position, I recommend to divide theme file if you want greatly different styling, to avoid too complex CSS.

But what your use case can we cover if Marp Core had assigned some class (or data attribute) depending on size?

@melck
Copy link
Author

melck commented Dec 5, 2019

Ok, I understand. Firstly I use mainly marp to write slide deck.

I like so much the simplicity that i wanted to use it to make printed document (A4 size). I need header, footer, page, etc. To keep this simple i wanted to include all css in one theme and split it by size.

With this i will be able to write only markdown with vscode, and never have to use office product again :D.

Do you think marpit can be used for that ?

@yhatt
Copy link
Member

yhatt commented Dec 5, 2019

I feel you. There are not many better solution for Markdown -> PDF document conversion with simple styling.

I'll consider to expose which size selected through global directive. In theme CSS, specific style could apply by size.

/*!
 * @theme xxx
 * @size 4:3 960px 720px
 * @size A4 210mm 297mm
 */

section {
  /* Default style (16:9) */
}

section[data-size="4:3"] {
  /* Style for 4:3 slide */
}

section[data-size="A4"] {
  /* Style for A4 slide */
}

@yhatt yhatt added enhancement New feature or request and removed question Not issue, just a question enhancement New feature or request labels Dec 5, 2019
@melck
Copy link
Author

melck commented Dec 9, 2019

Perfect it's exactly what i need :)

@yhatt
Copy link
Member

yhatt commented Jan 13, 2020

data-size attribute is available in just released v1.0.0.

@yhatt yhatt closed this as completed Jan 13, 2020
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

No branches or pull requests

2 participants