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

Get back size global directive and 4:3 slide #94

Merged
merged 8 commits into from
Jun 24, 2019
Merged

Conversation

yhatt
Copy link
Member

@yhatt yhatt commented Jun 22, 2019

size global directive is getting back from the old Marp app! 🎉

I've added Marp size plugin and @size theme metadata. It would allow using a traditional 4:3 slide in built-in themes in easier way.

---
theme: default
size: 4:3
---

# <!--fit--> Hello!
size Default theme Gaia theme Uncover theme
Default (16:9) default gaia uncover
4:3 default-43 gaia-43 uncover-43

It also improves backward compatibility of Marp syntax. For example, directive comment in the old Marp app like <!-- $size: 4:3 --> would work in Marp Next too.

Fix #91.

Marp size plugin

An added plugin will update the registered theme instance to use pre-defined size when size global directive matches with the name of @size metadata in used theme. They have overridden section style and would revert after rendered by Marp.render().

@size theme metadata

Marp Core's theme set has @size [name] [width] [height] metadata(s) support to define size presets.

Following is an example to define A4 document preset in custom theme. (NOTE: Presets for document are not supported in built-in themes because we've focused to presentation.)

/**
 * @theme theme-for-document
 * @size A4 210mm 297mm
 */
---
theme: theme-for-document
size: A4
---

# Theme for document

An inherited custom theme from built-in theme still can use defined presets in base theme.

/**
 * @theme custom-theme
 */

@import "default";
---
theme: custom-theme
size: 4:3
---

# 4:3 slide

If you want to disable a specific size preset, you can use @size [name] false.

/**
 * In this theme, 4:3 slide cannot use even if defined `size` global directive.
 *
 * @theme custom-theme
 * @size 4:3 false
 **/

@import "default";

section {
  /* 6K ultra-wide presentation */
  width: 5760px;
  height: 1080px;
}

ToDo

  • Test size plugin
  • Test 4:3 slide for built-in themes
  • Update documentation
    • README.md (size global directive)
    • themes/README.md (@size metadata)

@yhatt
Copy link
Member Author

yhatt commented Jun 23, 2019

Our concern is lack the support of responsive size in existing auto-scaling feature.

max-height: 563px; // Slide height - padding * 2

By merging this feature, we have to think extra features complicatedly.

In the first place, Marpit framework does never need responsive size. According to a feedback from user, a core reason is lacked custom theme support in Marp Web. We have already planning to support custom theme in Web interface (but we have no time to work for Web currently).

This extra feature can resolve it temporarily, but our headache from extra features might grow by complexibillity.

@yhatt
Copy link
Member Author

yhatt commented Jun 24, 2019

We will just give it try this for taking feedback.

@yhatt yhatt merged commit 4909fd4 into master Jun 24, 2019
@yhatt yhatt deleted the size-global-directive branch June 24, 2019 13:34
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.

Get back size global directive
1 participant