title | author | date | headerl | headerr | footerl | title-slide-background-image | toc-slide-background-image | level1-slide-background-image | level2-slide-background-image | level3-slide-background-image | background-size | toc-depth |
---|---|---|---|---|---|---|---|---|---|---|---|---|
Markdown RevealJS |
<img src="$reporoot-url$/images/me.png" style="height:1.5em;">xieby1 |
🎉2022.06.10 |
<img src="$reporoot-url$/images/me.png" style="height:1.2em;"> |
<a href="https://github.com/xieby1/markdown_revealjs"><img src="https://github.com/fluidicon.png" style="width:16pt;">Github Repo</a> |
cover |
1 |
A Simple Easy Converter
- Based on Pandoc
- Auto-generated TOC
- Touch-device friendly
- Header footer supported
This README.md is converted to revealjs, see it here.
Bash script + Template file + Pandoc
It's simple and esay!
git clone https://github.com/xieby1/markdown_revealjs
Note: Ubuntu 22's apt-installed pandoc is too old.
::: {.fragment} 👍That's it!
🎊You've installed markdown_revealjs! :::
Add revealjs.sh to your PATH env.
ln -s <path/to>/revealjs.sh /usr/bin/
# or /usr/local/bin/, or ~/.local/bin/
Add the metadata (title, author, date)
to top of your markdown file.
These info will become the first page of your slide.
% markdown_revealjs !
% xieby1
% 2022.06.24
syntax | meaning |
---|---|
1st-level header | New horizontal slide |
2nd/3rd/4th/5th/6th-level header | New vertical slide |
$ revealjs.sh <input.md>
# will generate input.html
🐱
It's simple and easy, right?
Here are predefined themes (template),
just download the source markdown,
and [revealjs.sh xxx.md
]{style="font-size: 1.5em;"}!
Enjoy the themes below🎉
🔽🔽🔽
<iframe src="./themes/loongson.html" style="width:800px; height: 450px;"></iframe> <iframe src="./themes/ict_mtrc_proposal.html" style="width:800px; height: 450px;"></iframe> <iframe src="./themes/ucas_ict_thesis.html" style="width:800px; height: 450px;"></iframe>Sorted in alphabet.
All elements
in Reveal.JS
are centered
by default.
😺
:::{style="display:inline-block; text-align:left;"} If you prefer to left align
all children elements.
Add these styles
to the parent element.
😽
:::{style="display:inline-block; text-align:left;"}
things here are all
left aligned
!
:::
:::
Did you notice that every page has a default background?
Set default backgrounds in yml front matter, like
title-slide-background-image: <URL>
toc-slide-background-image: <URL>
level1-slide-background-image: <URL>
level2-slide-background-image: <URL>
level3-slide-background-image: <URL>
background-size: <CSS background-size>
Set per-slide background, like
# Per-Slide Backgrounds {data-background-color="LightPink"}
More info about background see:
- RevealJS: backgrounds
- Pandoc Extension: header_attributes
- RevealJS: fragments
::: {.fragment}
- Pandoc Extension: fenced_divs ::: ::: {.fragment}
::: {.fragment}
Your content here
:::
:::
- Pandoc Extension: bracketed_spans
[It's in one line!]{.fragment} [🐱]{.fragment} [🐶]{.fragment} [🐹]{.fragment}
:::{.fragment}
[It's in one line!]{.fragment}
[🐱]{.fragment}
[🐶]{.fragment}
[🐹]{.fragment}
:::
Normally, each level of heading will start a new slide.
If you want a heading that doesn a new slide, like this
Just use html heading!
<h3>Level-3 Heading!</h3>
If you want to start a new slide without headings.
Just use the markdown horizontal break ---
, like this
Force starting a new slide!
./included.md
More details: https://github.com/pandoc/lua-filters/blob/master/include-files/include-files.lua
``` {include="./helloworld.c"}
```
More details: https://github.com/pandoc/lua-filters/blob/master/include-code-files/include-code-files.lua
::: {.container} :::: {.col}
include a chart.js plot
``` {.include}
./plots/chartjs.html
```
:::: :::: {.col}
./plots/chartjs.html
:::: :::
::: {.container} :::: {.col}
include a plotly.py plot
``` {.include}
./plots/plotlypy.html
```
:::: :::: {.col}
./plots/plotlypy.html
:::: :::
You can label a slide by adding a name to its heading
# Label and Link {#label_and_link}
Then you can go back to the labeled slide ⬆️ Label and Link⬆️ .
[Label and Link](#label_and_link)
markdown_revealjs
can be used completely offline!
# download by git
git clone https://github.com/xieby1/markdown_revealjs
# or download the source code without .git
wget https://github.com/xieby1/markdown_revealjs/archive/master.tar.gz
tar xzf master.tar.gz
Assuming the path to the local repo is <REPO>
REPOROOT=<REPO> <REPO>/bin/revealjs.sh <MD File>
Then you can view your slides completely offline!
Bother by long table?
::: {.fragment} Then use wrap your long table
with [.longtable
]{style="font-size:1.5em;"} like below
::: {.longtable style="height: 300px;"}
<your long table here>
:::
:::
::: {.longtable style="height: 500px;"}
This | is | a | long | vertical | table |
---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 |
2 | 2 | 3 | 4 | 5 | 6 |
3 | 2 | 3 | 4 | 5 | 6 |
4 | 2 | 3 | 4 | 5 | 6 |
5 | 2 | 3 | 4 | 5 | 6 |
6 | 2 | 3 | 4 | 5 | 6 |
7 | 2 | 3 | 4 | 5 | 6 |
8 | 2 | 3 | 4 | 5 | 6 |
9 | 2 | 3 | 4 | 5 | 6 |
10 | 2 | 3 | 4 | 5 | 6 |
11 | 2 | 3 | 4 | 5 | 6 |
12 | 2 | 3 | 4 | 5 | 6 |
13 | 2 | 3 | 4 | 5 | 6 |
14 | 2 | 3 | 4 | 5 | 6 |
15 | 2 | 3 | 4 | 5 | 6 |
16 | 2 | 3 | 4 | 5 | 6 |
17 | 2 | 3 | 4 | 5 | 6 |
18 | 2 | 3 | 4 | 5 | 6 |
19 | 2 | 3 | 4 | 5 | 6 |
20 | 2 | 3 | 4 | 5 | 6 |
::: |
Write latex math equation like this
$$
F = G \frac{m_1 \times m_2}{R^2}
$$
- Pandoc Extension: fenced_divs
- Builtin CSS class: container and col
::: {.container} :::: {.col} It is two columns!
This is column 1 :::: :::: {.col} This is column 2
::: {.container}
:::: {.col}
Column 1
::::
:::: {.col}
Column 2
::::
:::
:::: :::
You can add as many columns as possible.
::: {.container style="align-items: flex-start;"} :::: {.col}
- Default is center alignment
- This is top alignment :::: :::: {.col}
Top alignment code:
::: {.container style="align-items: flex-start;"}
:::: {.col}
col1
::::
:::: {.col}
col2
::::
:::
:::: :::
::: {.container style="align-items: flex-end;"} :::: {.col}
- Default is center alignment
- This is bottom alignment
::: {.container style="align-items: flex-end;"}
:::: {.col}
col1
::::
:::: {.col}
col2
::::
:::
Because markdown_revealjs
is just
[a shell wrapper of pandoc]{style="font-size:1.5em;"}.
::: {.fragment} You can [override]{style="font-size:1.5em;"} them! :::
::: {.fragment style="font-size: 0.5em;"}
See pandoc available options by pandoc -h
:::
Override in md file metadata, like
pandoc-opts: "<PANDOC OPTIONS>"
Example:
---
title: Markdown RevealJS
author: xieby1
date: 2022.06.10
...
pandoc-opts: "--toc=false"
---
Override by appending reveal.sh
command, like
reveal.sh <MD File> <PANDOC OPTIONS>
Example:
reveal.sh README.md --toc=false
Slides after the specific slides
can be excluded from the total slide number.
Think about a situation where,
in your PhD defense,
there are several backup slides at the end.
You do not want them counted to the total slide number.
Add .slide-count-end
to the heading of the slide,
# Heading {.slide-count-end}
In this README, .slide-count-end
is added to slide [QnA].
Therefore, the slides after [QnA], like [Backup Slides]
are not counted to total slide number
See,
some key TOC entries are resident at the top of the slides?
- Top slide without subsequent vertical slides
data-name="<TOC_Entry_Name>"
- Top slide with subsequent vertical slides
data-stack-name="<TOC_Entry_Name>"
- Example:
::: {.container} :::: {.col}
...
# H1 {data-name="h1"}
# H2 {data-stack-name="h2"}
## H2_1
...
Want to hide resident TOC in specific slides?
Add data-sminvisible=true
to the slide heading, like
## Hide Resident TOC {data-sminvisible=true}
...
My 国科大计算所答辩 theme use resident TOC
<iframe src="./themes/ucas_ict_thesis.html" style="width:800px; height: 450px;"></iframe>Resident TOC is implemented based on revealjs plugin:
martinomagnifico/reveal.js-simplemenu.
Default TOC depth is 2.
You can override it in yml front matter, like
toc-depth: 1
The number of TOC columns is controlled by yml front matter:
toc-column-width
for TOC's column widthtoc-margin
for TOC's margin
Therefore, by adjusting these two variable,
you can control how many TOC columns you have.
- Remember the default slide width is 1200px.
- The default
toc-column-width
is290px
- The default
toc-margin
is0 0 0 0
- Thus a 3-column toc is presented.
Here is an example of 1-column TOC
toc-column-width: unset
toc-margin: 0 400px
- Problems?
- tips?
- Advice?
New issue and pull request is welcome!
Test the functionality of [Slide Number End].
From this slide on,
the total slide number ends counting.
🐱
🐈