cicero documentation

35
Cicero Documentation Release 0.2.5 Radovan Bast, Ole Martin Bjørndalen, and Roberto Di Remigio Jan 15, 2022

Upload: others

Post on 19-Apr-2022

11 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Cicero Documentation

Cicero DocumentationRelease 0.2.5

Radovan Bast, Ole Martin Bjørndalen, and Roberto Di Remigio

Jan 15, 2022

Page 2: Cicero Documentation
Page 3: Cicero Documentation

First steps

1 Getting started in 5 minutes 3

2 Exporting slides to PDF 5

3 Running the app locally 7

4 How to use your own CSS 9

5 Images 11

6 Background image 13

7 How to customize everything 15

8 Math equations 17

9 v3 19

10 v2 21

11 v1 23

12 Running your own server 25

13 Environment variables 27

14 Dependencies 29

15 Setting up your environment 31

i

Page 4: Cicero Documentation

ii

Page 5: Cicero Documentation

Cicero Documentation, Release 0.2.5

You write your talk in Markdown, host it on GitHub or GitLab. We render it using remark of reveal.js and serve itfor you before you can say blueberry pie. You can style your slides to your heart’s content.

First steps 1

Page 6: Cicero Documentation

Cicero Documentation, Release 0.2.5

2 First steps

Page 7: Cicero Documentation

CHAPTER 1

Getting started in 5 minutes

Place the following Markdown file on https://github.com or https://gitlab.com, perhaps as mytalk.md:

class: center, middle

# Simple example presentation

## Author

---

## Another slide

Try **F** and **P** keys.

- A bullet point- Another convincing argument

---

## Code blocks are no problem

Here we have some Python code:

```pythonfrom itertools import cycle

fizz = cycle(['', '', 'Fizz'])buzz = cycle(['', '', '', '', 'Buzz'])

for i in range(1, 101):print((next(fizz) + next(buzz)) or i)

```

[Source](https://github.com/olemb/nonsense/blob/master/fizzbuzz/itertools_cycle.py)

(continues on next page)

3

Page 8: Cicero Documentation

Cicero Documentation, Release 0.2.5

(continued from previous page)

---

## Images

An image fetched from the web:

![Sample image](https://upload.wikimedia.org/wikipedia/commons/thumb/4/4f/The_Young_→˓Cicero_Reading.jpg/316px-The_Young_Cicero_Reading.jpg)

Let us assume your talk is on (replace <namespace> and <repository>):

https://github.com/<namespace>/<repository>/mytalk.md

You can now visit (replace <namespace> and <repository>):

https://cicero.xyz/v3/remark/0.14.0/github.com/<namespace>/<repository>/main/mytalk.md

Of course you can reference another branch or tag or hash than main.

If you like https://revealjs.com better, then check https://github.com/bast/cicero/tree/main/demo/reveal.js.

4 Chapter 1. Getting started in 5 minutes

Page 9: Cicero Documentation

CHAPTER 2

Exporting slides to PDF

The to my knowledge best way to export slides to PDF is using https://github.com/astefanutti/decktape.

First install the tool following https://github.com/astefanutti/decktape#install, then you can export slides, e.g.:

$ decktape https://example.org/my-slides.md/ my-slides.pdf

If you prefer not to install it but have Singularity installed, you can do this instead:

$ singularity pull docker://astefanutti/decktape$ ./decktape_latest.sif https://example.org/my-slides.md/ my-slides.pdf

5

Page 10: Cicero Documentation

Cicero Documentation, Release 0.2.5

6 Chapter 2. Exporting slides to PDF

Page 11: Cicero Documentation

CHAPTER 3

Running the app locally

You can preview your changes locally and also present your talk without relying on https://cicero.xyz:

$ pip install cicero$ cicero --file /home/user/my-talk/talk.md

3.1 Available options

$ cicero --help

usage: cicero.py [-h] [--file FILENAME] [--engine ENGINE] [--debug][--host HOST] [--port PORT]

optional arguments:-h, --help show this help message and exit--file FILENAME, -f FILENAME

serve a local file (default: None)--engine ENGINE rendering engine (available: remark-0.13.0,

remark-0.14.0, remark-legacy, reveal.js-3.7.0)(default: remark-0.14.0)

--debug--host HOST--port PORT

7

Page 12: Cicero Documentation

Cicero Documentation, Release 0.2.5

8 Chapter 3. Running the app locally

Page 13: Cicero Documentation

CHAPTER 4

How to use your own CSS

If you place a file in the same path as your talk, with the same name as your talk, and only replace the .md suffix by.css. Then the rendering engine will use this file: https://github.com/bast/cicero/blob/main/cicero/templates/render.html#L11-L13

In other words, if your talk is called mytalk.md and you want to customize CSS, place a file called mytalk.cssin the same place as your mytalk.md.

With this you can even override CSS directives and style your slides to your heart’s content.

Example: https://github.com/bast/cicero/tree/main/demo/remark/styling

9

Page 14: Cicero Documentation

Cicero Documentation, Release 0.2.5

10 Chapter 4. How to use your own CSS

Page 15: Cicero Documentation

CHAPTER 5

Images

You can either include images the Markdown way:

![alt text](https://github.com/adam-p/markdown-here/raw/master/src/common/images/→˓icon48.png "Logo Title Text 1")

![alt text](path/myimage.jpg "Local image")

or the HTML way:

<img src="file.jpg" style="height: 450px;"/>

11

Page 16: Cicero Documentation

Cicero Documentation, Release 0.2.5

12 Chapter 5. Images

Page 17: Cicero Documentation

CHAPTER 6

Background image

6.1 remark

Setting and changing the background image is nicely documented here: https://github.com/gnab/remark/wiki/Markdown#background-image

13

Page 18: Cicero Documentation

Cicero Documentation, Release 0.2.5

14 Chapter 6. Background image

Page 19: Cicero Documentation

CHAPTER 7

How to customize everything

You want to change looks and fonts? CSS is not enough? Perhaps you need an external JavaScript library?

You can place *.head.html and/or *.body.html alongside your *.md slides. In these files you can do andchange almost everything: https://github.com/bast/cicero/blob/main/cicero/templates/render.html.

To get inspired of what is in these by default and what can be changed, please browse https://github.com/bast/cicero/tree/main/cicero/static/engines.

15

Page 20: Cicero Documentation

Cicero Documentation, Release 0.2.5

16 Chapter 7. How to customize everything

Page 21: Cicero Documentation

CHAPTER 8

Math equations

Here is an example: https://github.com/bast/cicero/tree/main/demo/remark/equations

17

Page 22: Cicero Documentation

Cicero Documentation, Release 0.2.5

18 Chapter 8. Math equations

Page 23: Cicero Documentation

CHAPTER 9

v3

This API is currently the default:

/v3/<engine>/<engine_version>/<repo>/<branch>/<path>

Examples with files on GitHub:

• https://cicero.xyz/v3/remark/0.14.0/github.com/bast/cicero/main/demo/remark/simple/talk.md

• https://cicero.xyz/v3/remark/0.14.0/github.com/bast/cicero/main/demo/remark/styling/talk.md

• https://cicero.xyz/v3/remark/0.14.0/github.com/bast/cicero/main/demo/remark/equations/talk.md

• https://cicero.xyz/v3/remark/0.14.0/github.com/bast/cicero/main/demo/remark/original/talk.md

• https://cicero.xyz/v3/remark/0.14.0/github.com/bast/cicero/main/demo/remark/header-footer/talk.md

• https://cicero.xyz/v3/reveal.js/3.7.0/github.com/bast/cicero/main/demo/reveal.js/talk.md

Examples with files on GitLab:

• https://cicero.xyz/v3/remark/0.14.0/gitlab.com/bast/cicero-example/master/demo/remark/simple/talk.md

• https://cicero.xyz/v3/remark/0.14.0/gitlab.com/bast/cicero-example/master/demo/remark/styling/talk.md

• https://cicero.xyz/v3/remark/0.14.0/gitlab.com/bast/cicero-example/master/demo/remark/equations/talk.md

• https://cicero.xyz/v3/remark/0.14.0/gitlab.com/bast/cicero-example/master/demo/remark/original/talk.md

• https://cicero.xyz/v3/reveal.js/3.7.0/gitlab.com/bast/cicero-example/master/demo/reveal.js/talk.md

19

Page 24: Cicero Documentation

Cicero Documentation, Release 0.2.5

20 Chapter 9. v3

Page 25: Cicero Documentation

CHAPTER 10

v2

This API is the past but still supported:

/v2/remark/github/<namespace>/<repo>/<branch>/<path>

Example: https://cicero.xyz/v2/remark/github/bast/cicero/main/demo/remark/original/talk.md

21

Page 26: Cicero Documentation

Cicero Documentation, Release 0.2.5

22 Chapter 10. v2

Page 27: Cicero Documentation

CHAPTER 11

v1

This API is deprecated since it does not allow talks in subdirectories:

/v1/github/<namespace>/<repo>/<branch>/<path>/remark/

23

Page 28: Cicero Documentation

Cicero Documentation, Release 0.2.5

24 Chapter 11. v1

Page 29: Cicero Documentation

CHAPTER 12

Running your own server

You can run your own Cicero instance on your own server. Cicero is a Flask app and to serve it you should use aWSGI server for production. The sources are open: https://github.com/bast/cicero

25

Page 30: Cicero Documentation

Cicero Documentation, Release 0.2.5

26 Chapter 12. Running your own server

Page 31: Cicero Documentation

CHAPTER 13

Environment variables

You will need to define CICERO_URL_BASE to the URL of your server. This sets the URL base for generated linksin the Markdown file finder.

As an example, for https://cicero.xyz we set:

CICERO_URL_BASE=https://cicero.xyz

27

Page 32: Cicero Documentation

Cicero Documentation, Release 0.2.5

28 Chapter 13. Environment variables

Page 33: Cicero Documentation

CHAPTER 14

Dependencies

The app depends on the following Python packages:

• Flask 1.0.2

• Requests 2.20.0

On the front-end side we depend on the following libraries:

• Vue 2.5.16

• Bootstrap 4.1.3

29

Page 34: Cicero Documentation

Cicero Documentation, Release 0.2.5

30 Chapter 14. Dependencies

Page 35: Cicero Documentation

CHAPTER 15

Setting up your environment

First install the dependencies (you need a network connection for this step):

$ git checkout https://github.com/bast/cicero$ cd cicero

Now install https://flit.readthedocs.io/ from requirements.txt.

Then install the package and start the server:

$ flit install --symlink$ cicero

* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)

31