xieby1
🎉2022.06.10
A Simple Easy Converter
This README.md is converted to revealjs, see it here.
Bash script + Template file + Pandoc
It’s simple and esay!
git clone --recurse-submodules https://github.com/xieby1/markdown_revealjs
Note: Ubuntu 22’s apt-installed pandoc is too old.
👍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?
$ revealjs.sh -d <input.md>
# will auto refresh browser when input.md is changed
Here are predefined themes (template),
just download the source markdown,
and revealjs.sh xxx.md
!
Enjoy the themes below🎉
🔽🔽🔽
Sorted in alphabet.
All elements
in Reveal.JS
are centered
by default.
😺
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
!
:::
```python {data-id="code-animation" data-line-numbers=""}
class Miao:
def __init__(self):
pass
```
class Miao:
def __init__(self):
pass
```python {data-id="code-animation" data-line-numbers=""}
# This is a class
class Miao:
# This is a func def
def __init__(self):
pass
```
# This is a class
class Miao:
# This is a func def
def __init__(self):
pass
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:
::: {.fragment}
Your content here
:::
It’s in one line! 🐱 🐶 🐹
[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!
This file is include by
```{.include}
./included.md
```
More details: https://github.com/pandoc/lua-filters/blob/master/include-files/include-files.lua
``` {include="./helloworld.c"}
```
#include <stdio.h>
int main(void);
int main(void)
{
printf("Hello, world! \n");
return 0;
}
More details: https://github.com/pandoc/lua-filters/blob/master/include-code-files/include-code-files.lua
include a chart.js plot
``` {.include}
./plots/chartjs.html
```
include a plotly.py plot
``` {.include}
./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 --recurse-submodules 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?
Then use wrap your long table
with .longtable
like below
::: {.longtable style="height: 300px;"}
<your long table here>
:::
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}
$$
\[ F = G \frac{m_1 \times m_2}{R^2} \]
It is two columns!
This is column 1
This is column 2
::: {.container}
:::: {.col}
Column 1
::::
:::: {.col}
Column 2
::::
:::
You can add as many columns as possible.
Top alignment code:
::: {.container style="align-items: flex-start;"}
:::: {.col}
col1
::::
:::: {.col}
col2
::::
:::
Top alignment code:
::: {.container style="align-items: flex-end;"}
:::: {.col}
col1
::::
:::: {.col}
col2
::::
:::
Because markdown_revealjs
is just
a shell wrapper of pandoc.
You can override them!
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.
.slide-count-end
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?
data-name="<TOC_Entry_Name>"
data-stack-name="<TOC_Entry_Name>"
...
# 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
Resident TOC is implemented based on revealjs plugin:
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-width
for TOC widthtoc-column-width
for TOC’s column widthtoc-margin
for TOC’s marginTherefore, by adjusting these two variable,
you can control how many TOC columns you have.
toc-column-width
is 290px
toc-margin
is 0 0 0 0
Here is an example of 1-column TOC
toc-width: 1200px
toc-column-width: unset
toc-margin: 0 400px
New issue and pull request is welcome!
Test the functionality of Slide Number End.
From this slide on,
the total slide number ends counting.
🐱
🐈