Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
elements. (#270)
- "Go to source" by `Ctrl`+clicking (or `Cmd`+clicking on Mac) anywhere in the
preview. (#270)
- Added [tachyons](https://tachyons.io/) support (#278)

### Changed

Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ The directory structure is the following:
- `release/` for scripts used in the release process
- `test/` for tests
- `vendor/` for vendored library, see the vendoring section of this document
- `static_data/` contains static data such as highlightjs code to embed in a
presentation.
- `src/` for the source:
- `src/engine/` for all code running in the browser
- `src/engine/runtime/` contains the code for the engine, the part translated to
Expand All @@ -67,8 +69,6 @@ The directory structure is the following:
- `src/engine/themes/` contains the CSS themes.
- `src/cli/` contains the code for the CLI parsing (using cmdliner) and calling
the right entry point (preview server, compiler, ...)
- `src/static_data/` contains static data such as highlightjs code to embed in a
presentation.
- `src/server/` contains the code for the preview server
- `src/server/client/` contains the code for the client-side javascript of the preview server
- `src/communication/` contains the types and utilities to serialize and
Expand Down
32 changes: 24 additions & 8 deletions LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
contains a vendored and slightly modified copy of
[lwd](https://github.com/let-def/lwd). It is licensed under the [MIT
license](#lwd-copyrights).
- The [`src/static_data`
directory](https://github.com/panglesd/slipshow/tree/main/src/static_data/)
- The [`static_data`
directory](https://github.com/panglesd/slipshow/tree/main/static_data/)
contains various (compiled) JavaScript libraries:
- Files that start with `highlight-js.` are part of the [highlight-js
project](https://highlightjs.org/) and under the [BSD 3-Clause
Expand All @@ -41,11 +41,14 @@
[perfect-freehand](https://github.com/steveruizok/perfect-freehand) JS
library, under the [MIT licence](#perfect-freehand-copyrights).
- The [`katex` javascript library](https://github.com/KaTeX/KaTeX/) is present
in `src/static_data/katex/` , under the [MIT
licence](#katex-copyright).
- The [`mermaid` javascript library](https://github.com/mermaid-js/mermaid/) is present
in `src/static_data/mermaid/` , under the [MIT
licence](#mermaid-js-copyright).
in `static_data/katex/` , under the [MIT licence](#katex-copyrights).
- The [`mermaid` javascript library](https://github.com/mermaid-js/mermaid/) is
present in `static_data/mermaidjs/` , under the [MIT
licence](#mermaid-js-copyrights).
- The [`tachyons` css framework](https://github.com/tachyons-css/tachyons) is
present in `static_data/tachyons-4.12.0.min.css`, under the [MIT
licence](#tachyons-copyrights). It was
[modified](https://github.com/panglesd/tachyons/).

The rest of the code, and the Slipshow project in general, is licensed under the
GPL v3 license:
Expand Down Expand Up @@ -1288,7 +1291,6 @@ SOFTWARE.

# Mermaid JS copyrights


```
The MIT License (MIT)

Expand All @@ -1312,3 +1314,17 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```

# Tachyons copyrights

```
The MIT License (MIT)

Copyright © 2020 Adam Morse & John Otander

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
```
3 changes: 3 additions & 0 deletions docs/frontmatter.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ The current options for the frontmatter are:
of space-separated ids. This is just in order to silence some warnings. This
is useful when including svgs or math where some IDs are given.

- ``tachyons``, for telling the Slipshow compiler to include the ``tachyons``
CSS framework. See the docs on :doc:`tachyons` support.

Multifile presentations
=======================

Expand Down
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,4 @@ We advise you to start by reading the tutorials, starting with the :doc:`first <
shortcuts
cli
mermaid
tachyons
24 changes: 24 additions & 0 deletions docs/tachyons.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
========
Tachyons
========

`Tachyons <https://tachyons.io/>`_ is a CSS framework. It allows to style
elements by assigning them classes. For instance, to give a blue text color on a
red background:

.. code-block::

---
tachyons: true
---

{.blue .bg-red}
Hello!

As seen in the example above, the inclusion of tachyons is not automatic, you
need to add it to the frontmatter.

You can find all classes and the corresponding CSS rule in the `tachyons doc
<https://tachyons.io/docs/>`_. Note however that no "media query" rules are
included, nor the ``font-family`` ones (as fonts need to be embedded to have a
truly standalone HTML file).
2 changes: 1 addition & 1 deletion dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

(maintainers "Paul-Elliot")

(license GPL-3.0-or-later ISC BSD-3-Clause Apache-2.0 OFL-1.1)
(license GPL-3.0-or-later ISC BSD-3-Clause Apache-2.0 OFL-1.1 MIT)

(documentation https://slipshow.readthedocs.io)

Expand Down
4 changes: 3 additions & 1 deletion slipshow.opam
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ description:
"Slipshow is an engine to write slips, a concept evolved from slides."
maintainer: ["Paul-Elliot"]
authors: ["Paul-Elliot"]
license: ["GPL-3.0-or-later" "ISC" "BSD-3-Clause" "Apache-2.0" "OFL-1.1"]
license: [
"GPL-3.0-or-later" "ISC" "BSD-3-Clause" "Apache-2.0" "OFL-1.1" "MIT"
]
tags: ["slipshow" "presentation" "slideshow" "beamer"]
homepage: "https://github.com/panglesd/slipshow"
doc: "https://slipshow.readthedocs.io"
Expand Down
22 changes: 22 additions & 0 deletions src/compiler/frontmatter.ml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ let dimension_key = "dimension"
let highlightjs_theme_key = "highlightjs-theme"
let math_mode_key = "math-mode"
let css_links_key = "css"
let tachyons_key = "tachyons"
let js_links_key = "js"
let external_ids_key = "external-ids"

Expand All @@ -36,6 +37,7 @@ module Global = struct
js_links : Uri.t loced list;
external_ids : string list;
toplevel_attributes : Cmarkit.Attributes.t Cmarkit.node option;
tachyons : bool loced option;
}
(** We keep an option even though there are default value to be able to merge
two frontmatter. None and default value represent different things. *)
Expand All @@ -53,6 +55,7 @@ module Global = struct
js_links = [];
external_ids = [];
toplevel_attributes = None;
tachyons = None;
}

let with_empty x = { x; fm = empty }
Expand All @@ -78,6 +81,7 @@ module Global = struct
meta1 )
| (Some _ as a), _ | _, (Some _ as a) -> a
| None, None -> None);
tachyons = combine_opt tachyons_key x.tachyons y.tachyons;
}

let uris
Expand All @@ -91,6 +95,7 @@ module Global = struct
js_links;
external_ids = _;
toplevel_attributes = _;
tachyons = _;
} :
t) =
let math_link = Option.to_list math_link in
Expand Down Expand Up @@ -243,6 +248,22 @@ module Css_links = struct
{ fm with global = { fm.global with css_links = v @ fm.global.css_links } }
end

module Tachyons = struct
type t = bool loced

let key = tachyons_key

let of_string ~to_uri:_ (s, loc) =
match s with
| "true" -> Ok (true, loc)
| "false" -> Ok (false, loc)
| _ -> Error (`Msg "Expected 'true' or 'false'")

let update_frontmatter (fm : fm) v =
let tachyons = combine_opt key (Some v) fm.global.tachyons in
{ fm with global = { fm.global with tachyons } }
end

module Js_links = struct
type t = Uri.t loced list

Expand Down Expand Up @@ -355,6 +376,7 @@ let all_fields =
(module Math_link : Field);
(module Theme : Field);
(module Css_links : Field);
(module Tachyons : Field);
(module Js_links : Field);
(module Hljs_theme : Field);
(module Math_mode : Field);
Expand Down
2 changes: 2 additions & 0 deletions src/compiler/frontmatter.mli
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ module Global : sig
js_links : Uri.t loced list;
external_ids : string list;
toplevel_attributes : Cmarkit.Attributes.t Cmarkit.node option;
tachyons : bool loced option;
}

type 'a with_ = { x : 'a; fm : t }
Expand Down Expand Up @@ -75,6 +76,7 @@ end

module Hljs_theme : Field_with_default with type t = string loced
module Math_mode : Field_with_default with type t = [ `Mathjax | `Katex ] loced
module Tachyons : Field with type t = bool loced

val of_string :
to_uri:(string -> (Uri.t, [ `Msg of string ]) result) ->
Expand Down
16 changes: 12 additions & 4 deletions src/compiler/slipshow.ml
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,12 @@ let slipshow_js_element files slipshow_link =
| None -> Format.sprintf "<script>%s</script>" Data_files.(read Slipshow_js)

let head ~files ~width ~height ~theme ~highlightjs_theme ~(has : Has.t)
~math_mode ~css_links =
~math_mode ~css_links ~tachyons =
let tachyons =
match tachyons with
| Some true -> "<style>" ^ Data_files.read Tachyons_css ^ "</style>"
| _ -> ""
in
let theme = theme_css files theme in
let highlight_css_element =
let s = Highlightjs.styles highlightjs_theme in
Expand Down Expand Up @@ -165,6 +170,7 @@ let head ~files ~width ~height ~theme ~highlightjs_theme ~(has : Has.t)
internal_css;
system_css;
theme;
tachyons;
css_elements;
highlight_css_element;
highlight_js_element;
Expand All @@ -177,11 +183,12 @@ let no_engine = ref false
let set_no_engine () = no_engine := true

let embed_in_page ~files ~has_speaker_view ~slipshow_js content ~has ~math_link
~css_links ~js_links ~theme ~dimension ~highlightjs_theme ~math_mode =
~css_links ~js_links ~theme ~dimension ~highlightjs_theme ~math_mode
~tachyons =
let width, height = dimension in
let head =
head ~files ~has ~css_links ~theme ~width ~height ~highlightjs_theme
~math_mode
~math_mode ~tachyons
in
let slipshow_js_element = slipshow_js_element files slipshow_js in
let js =
Expand Down Expand Up @@ -333,8 +340,9 @@ let delayed_from_units ?(options = Frontmatter.Global.empty) ?slipshow_js
Has.empty units.entry_point units.units
in
let files = units.files in
let tachyons = options.tachyons |> Option.map fst in
embed_in_page ~files ~has_speaker_view ~slipshow_js ~dimension ~has ~math_link
~theme ~css_links ~js_links content ~highlightjs_theme ~math_mode
~theme ~css_links ~js_links content ~highlightjs_theme ~math_mode ~tachyons

let delayed ~directory ?options ?slipshow_js ~read_file ~has_speaker_view
~embed_loc file =
Expand Down
Loading
Loading