Skip to content

Commit

Permalink
Update docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
KmolYuan committed May 12, 2022
1 parent 10695dd commit 7d10e59
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 34 deletions.
25 changes: 10 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,26 +58,21 @@ The executable can be checked with `rym` command.

The command `rym` stands for "Reveal-Yaml Manager".

```bash
# Download the latest Reveal.js archive
rym update
# Create/Initialize a project to current directory
# Only "reveal.yaml" will be create, the rest is up to you!
rym new PROJECT_PATH
rym init
# Serve the slides
rym serve
# Reformat the project file
rym fmt
# Pack the project to HTML archive
rym pack
```
| Command | Description |
|:--------|:------------------------------------------------|
| help | Show the CLI help message |
| update | Download the Reveal.js resources |
| new | Create a new project and its directory |
| init | Create a new project from an existing directory |
| serve | Serve the current project |
| fmt | Format the current project |
| pack | Pack the current project |

Please see `rym --help`/`rym subcommand --help` for more information.

### Edit Mode (Hot Reload / Auto-reload)

There are `-e` / `--edit` flags on the `serve` command. This option let the server keep watching the project file `reveal.yaml`, then reload the page from the web browser. (via JS & WebSocket)
There are `-e`/`--edit` flags on the `serve` command. This option let the server keep watching the project file `reveal.yaml`, then reload the page from the web browser. (via JS & WebSocket)

If this option is not enabled, the server will only resolve once at startup, and always use the cache.

Expand Down
19 changes: 8 additions & 11 deletions src/project/content/marked.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
use pulldown_cmark::{html::push_html, CodeBlockKind, Event, Options, Parser, Tag};

const MARKED: Options = Options::from_bits_truncate(
Options::ENABLE_TABLES.bits()
const MARKED: Options = {
let bits = Options::ENABLE_TABLES.bits()
| Options::ENABLE_SMART_PUNCTUATION.bits()
| Options::ENABLE_TASKLISTS.bits()
| Options::ENABLE_STRIKETHROUGH.bits(),
);
| Options::ENABLE_STRIKETHROUGH.bits();
Options::from_bits_truncate(bits)
};

fn marked(e: Event) -> Event {
match e {
Expand Down Expand Up @@ -34,11 +35,7 @@ fn marked(e: Event) -> Event {

/// Translate Markdown to HTML.
pub fn md2html(text: &str) -> String {
if text.is_empty() {
"".to_string()
} else {
let mut out = String::new();
push_html(&mut out, Parser::new_ext(text, MARKED).map(marked));
out
}
let mut doc = String::new();
push_html(&mut doc, Parser::new_ext(text, MARKED).map(marked));
doc
}
20 changes: 12 additions & 8 deletions src/project/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,28 +44,32 @@
//!
//! ### Multi-document Mode
//!
//! A regular Reveal.yaml project can be:
//! A regular Reveal.yaml project has two parts, metadata and a list of slides.
//! [`Metadata`] and [`Slides`].
//!
//! ```yaml
//! ## metadata block (map)
//! ## metadata block (map) - Metadata
//! ---
//! ## Slider block (sequence)
//! ## Slider block (sequence) - Sliders
//! - title: Title 1
//! - title: Title 2
//! ```
//!
//! Or multi-document with a leading metadata doc to reduce the indents.
//! [`Metadata`] and [`ChapterSlide`].
//!
//! ```yaml
//! ## metadata block (map)
//! ## metadata block (map) - Metadata
//! ---
//! ## Slider block 1 (map)
//! ## Slider block 1 (map) - ChapterSlide
//! title: Title 1
//! ---
//! ## Slider block 2 (map)
//! ## Slider block 2 (map) - ChapterSlide
//! title: Title 2
//! ```
//!
//! Please be aware that anchors cannot be referenced between different documents.
//!
//! ### Layout
//!
//! There are two layout types, called "horizontal stack" ([`Content::h_stack`]) and "vertical stack" ([`Content::v_stack`]). The vertical layout is default, as same as HTML.
Expand All @@ -85,8 +89,8 @@
//!
//! ```yaml
//! h-stack-border:
//! - doc: Splitted left
//! - doc: Splitted right
//! - doc: Left
//! - doc: Right
//! ```
//!
//! ### Sized Attribute
Expand Down

0 comments on commit 7d10e59

Please sign in to comment.