18
Marp How to build a Custom-Theme (workaround) 2016-09-11 eurie Inc. Takahiro Ikeuchi

How to build a custom theme for Marp

  • Upload
    -

  • View
    270.781

  • Download
    4

Embed Size (px)

Citation preview

Page 1: How to build a custom theme for Marp

Marp

How to build a Custom-Theme (workaround)

2016-09-11

eurie Inc. Takahiro Ikeuchi

Page 2: How to build a custom theme for Marp

What is Marp?

2

Page 3: How to build a custom theme for Marp

Marp is an awesome presentation writer

https://yhatt.github.io/marp/

3

Page 4: How to build a custom theme for Marp

Features of Marp

MarkdownSyntax support

Cross-platform (Electron Application)

Export slides as PDF

Of course these slides were written using Marp.

4

Page 5: How to build a custom theme for Marp

About to create a original theme

5

Page 6: How to build a custom theme for Marp

Themes of MarpMarp has two theme �les. (default, gaia)

Theme �les are written in Sass.

But, Marp could not apply user-style.

https://github.com/yhatt/marp/issues/1

6

Page 7: How to build a custom theme for Marp

Workaround to use your theme

1. Get the source code from Github.

2. Initialize the project.

3. Create a Sass �le in a theme directory.

4. Modify some co�eescript �les.

5. Build the project.

Please note that my approach is just aworkaround.

7

Page 8: How to build a custom theme for Marp

Initialize the project

$ npm install -g appdmg # cd $YOUR_PROJECT_DIRECTORY $ npm install

Create and edit a Sass �le

$ tree sass/themes/ sass/themes/ ├── _markdown.sass ├── _slide.sass ├── default.sass └── gaia.sass $ cp sass/themes/gaia.sass sass/themes/original.sass

8

Page 9: How to build a custom theme for Marp

Modify two co�eescript �les (1)

https://github.com/yhatt/marp/blob/master/co�ee/classes/mds_main_menu.co�ee#L269

Add the following object.

{ label: '&Original' enabled: @window? type: if @window? then 'radio' else 'normal' checked: @states.theme == 'original' click: => @window.mdsWindow.send 'setTheme', 'original' unless @window.mdsWindow.freeze }

9

Page 10: How to build a custom theme for Marp

Modify two co�eescript �les (2)

https://github.com/yhatt/marp/blob/master/co�ee/classes/mds_md_setting.co�ee#L32

Push 'original' to the array.

return if basename in ['default', 'gaia', 'original'] then "css/themes/#{basename}.css" else null

10

Page 11: How to build a custom theme for Marp

Finally, build the project.

npm start

You can choose "Original" theme.

11

Page 12: How to build a custom theme for Marp

Possibilities of custom-theme

12

Page 13: How to build a custom theme for Marp

Everything come true.

Yes, only on iPhone Marp.

13

Page 14: How to build a custom theme for Marp

14

Page 15: How to build a custom theme for Marp

Complex layoutsIf you really want to create some complex layoutson slides. You may write HTML directly.

<div style="text-align:right"> He liked to like people, therefore people liked him.</div>

15

Page 16: How to build a custom theme for Marp

<!-- template: cover -->

16

Page 17: How to build a custom theme for Marp

Hello Marp,

You don’t have to stay awake all-night to make slides any more.

17

Page 18: How to build a custom theme for Marp

AuthorTakahiro Ikeuchi @iktakahiro

Company / Community

eurie Inc. Founder & CEO

PyData.Tokyo Organizer

Specialties (or just a dabbler :-D

Go lang, Python, React.js, TypeScript

Cloud Infrastructure, UI Design etc...

18