Skip to content

Commit fead598

Browse files
authored
Merge pull request #19 from 3mdeb/figures_and_footnotes
Figures and footnotes
2 parents 5852e78 + f16db07 commit fead598

File tree

8 files changed

+127
-6
lines changed

8 files changed

+127
-6
lines changed

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,16 @@ Example:
7777

7878
You can then open given links to e.g. preview your presentation.
7979

80+
You can override the default copyright string using an `COPYRIGHT`
81+
environment variable:
82+
83+
```bash
84+
COPYRIGHT="All Rights Reserved by 3mdeb Sp. z o.o." \
85+
./slidev-template/scripts/render-slides.sh <path/to/slides.md>
86+
```
87+
88+
Default copyright is `3mdeb Sp. z o.o. Licensed under the CC BY-SA 4.0`.
89+
8090
## Export presentation
8191

8292
To export slides to PDF use
@@ -86,3 +96,13 @@ To export slides to PDF use
8696
```
8797

8898
Generated slides will be in `slidev-template/output` directory.
99+
100+
You can override the default copyright string using an `COPYRIGHT`
101+
environment variable:
102+
103+
```bash
104+
COPYRIGHT="All Rights Reserved by 3mdeb Sp. z o.o." \
105+
./slidev-template/scripts/ci/gen_slides.sh <path/to/slides.metadata>
106+
```
107+
108+
Default copyright is `3mdeb Sp. z o.o. Licensed under the CC BY-SA 4.0`.

components/Footnote.vue

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<template>
2+
<li class="ml-0! text-xs">
3+
<sup v-if="number">{{ number }}</sup>
4+
<slot />
5+
</li>
6+
</template>
7+
8+
<script setup lang="ts">
9+
defineProps<{
10+
number?: number;
11+
}>();
12+
</script>

components/Footnotes.vue

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<template>
2+
<div
3+
class="footnote left-15 text-left text-xs text-gray-600"
4+
v-bind:class="{
5+
'bg-main': filled,
6+
'z-1': filled,
7+
}"
8+
>
9+
<hr v-if="separator" />
10+
<ul
11+
class="flex flex-wrap !list-none px-5 py-2"
12+
v-bind:class="{
13+
'flex-col': y === 'col',
14+
'items-start': x === 'l' && y === 'col',
15+
'items-end': x === 'r' && y === 'col',
16+
'justify-start': x === 'l' && y === 'row',
17+
'gap-col-3': y === 'row',
18+
'gap-row-0.5': y === 'col',
19+
}"
20+
>
21+
<slot />
22+
</ul>
23+
</div>
24+
</template>
25+
26+
<script setup lang="ts">
27+
import { PropType } from 'vue';
28+
29+
defineProps({
30+
filled: {
31+
default: false,
32+
type: Boolean,
33+
},
34+
separator: {
35+
default: false,
36+
type: Boolean,
37+
},
38+
x: {
39+
default: 'r',
40+
type: String as PropType<'l' | 'r'>,
41+
validator: (value) => value === 'l' || value === 'r',
42+
},
43+
y: {
44+
default: 'row',
45+
type: String as PropType<'col' | 'row'>,
46+
validator: (value) => value === 'col' || value === 'row',
47+
}
48+
});
49+
</script>

global-top.vue

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<template>
2+
<div class="slide-body">
3+
<Scroll />
4+
<footer
5+
v-if="$nav.currentLayout !== 'cover'"
6+
class="absolute bottom-0 left-0 right-0 flex justify-between items-center py-2 text-[#000000]"
7+
>
8+
<small
9+
v-if="$slidev.configs.copyright && $slidev.configs.copyright.length !== 0"
10+
class="mx-auto"
11+
>© Copyright {{ new Date().getFullYear() }}. {{ $slidev.configs.copyright }}</small
12+
>
13+
<small v-else class="mx-auto"></small>
14+
15+
<small class="mr-4"><SlideCurrentNo/>/<SlidesTotal/></small>
16+
</footer>
17+
</div>
18+
</template>

scripts/ci/gen_slides.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,15 @@ gen_slides() {
2121
filename=$(basename "$input_file")
2222
filename=${filename%.*}
2323
day=${filename:0:1}
24+
copyright=${COPYRIGHT:-3mdeb Sp. z o.o. Licensed under the CC BY-SA 4.0}
25+
copyright=${copyright//\"/}
2426

2527
# Escape strings for sed
2628
escaped_file=$(printf 'slides/%s\n' "$input_file" | sed -e 's/[\/&$]/\\&/g')
2729

2830
# Create temporary markdown file using the slide template
29-
sed -e "s/<SRC>/$escaped_file/g" -e "s/<DAY>/$day/g" slides-template.md > slidev-template/slides.md
31+
sed -e "s/<SRC>/$escaped_file/g" -e "s/<DAY>/$day/g" -e "s/<COPYRIGHT>/$copyright/g" \
32+
slides-template.md >slidev-template/slides.md
3033

3134
cat slidev-template/slides.md
3235

scripts/render-slides.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,15 @@ render_slides() {
1414
filename=$(basename "$input_file")
1515
filename=${filename%.*}
1616
day=${filename:0:1}
17+
copyright=${COPYRIGHT:-3mdeb Sp. z o.o. Licensed under the CC BY-SA 4.0}
18+
copyright=${copyright//\"/}
1719

1820
# Escape strings for sed
1921
escaped_file=$(printf '%s\n' "$input_file" | sed -e 's/[\/&$]/\\&/g')
2022

2123
# Create temporary markdown file using the slide template
22-
sed -e "s/<SRC>/$escaped_file/g" -e "s/<DAY>/$day/g" slides-template.md >slidev-template/slides.md
24+
sed -e "s/<SRC>/$escaped_file/g" -e "s/<DAY>/$day/g" -e "s/<COPYRIGHT>/$copyright/g" \
25+
slides-template.md >slidev-template/slides.md
2326
cp slidev-template/vite.config.ts .
2427

2528
docker run -it --rm --user $(id -u):$(id -g) \

slides-template.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ drawings:
1313
transition: slide-left
1414
# enable MDC Syntax: https://sli.dev/features/mdc
1515
mdc: true
16+
copyright: <COPYRIGHT>
1617
---
1718

1819
## <TITLE>

theme/styles/slides.css

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -397,11 +397,9 @@ li {
397397
}
398398

399399
.footnote {
400-
bottom: 9em;
401-
font-size: 10px;
402-
left: 4em;
403400
position: absolute;
404-
right: 4em;
401+
bottom: 0px;
402+
margin-bottom: 20px;
405403
}
406404

407405
.hljs-default .hljs, .hljs-default .hljs-subst {
@@ -478,3 +476,20 @@ a {
478476
width: 55%;
479477
float: right;
480478
}
479+
480+
figure {
481+
border: 0px;
482+
}
483+
484+
figure img {
485+
margin-left: auto;
486+
margin-right: auto;
487+
}
488+
489+
figcaption {
490+
color: gray;
491+
font-style: italic;
492+
font-size: 14px;
493+
padding: 2px;
494+
text-align: center;
495+
}

0 commit comments

Comments
 (0)