From 51043a50b937c1ea637dc773cce154556bccef0b Mon Sep 17 00:00:00 2001 From: Jan-Erik Rediger Date: Wed, 6 Jan 2021 16:17:02 +0100 Subject: Remove now-unused CSS file --- README.md | 10 +- src/bin/assets/mermaid.css | 351 --------------------------------------------- src/bin/mdbook-mermaid.rs | 22 +-- 3 files changed, 9 insertions(+), 374 deletions(-) delete mode 100644 src/bin/assets/mermaid.css diff --git a/README.md b/README.md index d7aa76f..7514aef 100644 --- a/README.md +++ b/README.md @@ -46,14 +46,16 @@ This will add the following configuration to your `book.toml`: command = "mdbook-mermaid" [output.html] -additional-css = ["mermaid.css"] additional-js = ["mermaid.min.js", "mermaid-init.js"] ``` It will skip any unnecessary changes and detect if `mdbook-mermaid` was already configured. -Additionally it copies the files `mermaid.css`, `mermaid.min.js` and `mermaid-init.js` into your book's directory. +Additionally it copies the files `mermaid.min.js` and `mermaid-init.js` into your book's directory. You find these files in the [`src/bin/assets`](src/bin/assets) directory. +You can modify `mermaid-init.js` to configure Mermaid, see the [Mermaid documentation] for all options. + +[Mermaid documentation]: https://mermaid-js.github.io/mermaid/#/Setup?id=mermaidapi-configuration-defaults Finally, build your book: @@ -64,7 +66,7 @@ mdbook path/to/book ## License MPL. See [LICENSE](LICENSE). -Copyright (c) 2018-2020 Jan-Erik Rediger +Copyright (c) 2018-2021 Jan-Erik Rediger Mermaid is [MIT licensed](https://github.com/knsv/mermaid/blob/master/LICENSE). -The bundled assets (`mermaid.css`, `mermaid.min.js`) are MIT licensed. +The bundled assets (`mermaid.min.js`) are MIT licensed. diff --git a/src/bin/assets/mermaid.css b/src/bin/assets/mermaid.css deleted file mode 100644 index 74de2c1..0000000 --- a/src/bin/assets/mermaid.css +++ /dev/null @@ -1,351 +0,0 @@ -/* Flowchart variables */ -/* Sequence Diagram variables */ -/* Gantt chart variables */ -.mermaid .mermaid .label { - color: #333; -} -.mermaid .node rect, -.mermaid .node circle, -.mermaid .node ellipse, -.mermaid .node polygon { - fill: #ECECFF; - stroke: #CCCCFF; - stroke-width: 1px; -} -.mermaid .arrowheadPath { - fill: #333333; -} -.mermaid .edgePath .path { - stroke: #333333; -} -.mermaid .edgeLabel { - background-color: #e8e8e8; -} -.mermaid .cluster rect { - fill: #ffffde !important; - rx: 4 !important; - stroke: #aaaa33 !important; - stroke-width: 1px !important; -} -.mermaid .cluster text { - fill: #333; -} -.mermaid .actor { - stroke: #CCCCFF; - fill: #ECECFF; -} -.mermaid text.actor { - fill: black; - stroke: none; -} -.mermaid .actor-line { - stroke: grey; -} -.mermaid .messageLine0 { - stroke-width: 1.5; - stroke-dasharray: "2 2"; - marker-end: "url(#arrowhead)"; - stroke: #333; -} -.mermaid .messageLine1 { - stroke-width: 1.5; - stroke-dasharray: "2 2"; - stroke: #333; -} -.mermaid #arrowhead { - fill: #333; -} -.mermaid #crosshead path { - fill: #333 !important; - stroke: #333 !important; -} -.mermaid .messageText { - fill: #333; - stroke: none; -} -.mermaid .labelBox { - stroke: #CCCCFF; - fill: #ECECFF; -} -.mermaid .labelText { - fill: black; - stroke: none; -} -.mermaid .loopText { - fill: black; - stroke: none; -} -.mermaid .loopLine { - stroke-width: 2; - stroke-dasharray: "2 2"; - marker-end: "url(#arrowhead)"; - stroke: #CCCCFF; -} -.mermaid .note { - stroke: #aaaa33; - fill: #fff5ad; -} -.mermaid .noteText { - fill: black; - stroke: none; - font-family: 'trebuchet ms', verdana, arial; - font-size: 14px; -} -/** Section styling */ -.mermaid .section { - stroke: none; - opacity: 0.2; -} -.mermaid .section0 { - fill: rgba(102, 102, 255, 0.49); -} -.mermaid .section2 { - fill: #fff400; -} -.mermaid .section1, -.mermaid .section3 { - fill: white; - opacity: 0.2; -} -.mermaid .sectionTitle0 { - fill: #333; -} -.mermaid .sectionTitle1 { - fill: #333; -} -.mermaid .sectionTitle2 { - fill: #333; -} -.mermaid .sectionTitle3 { - fill: #333; -} -.mermaid .sectionTitle { - text-anchor: start; - font-size: 11px; - text-height: 14px; -} -/* Grid and axis */ -.mermaid .grid .tick { - stroke: lightgrey; - opacity: 0.3; - shape-rendering: crispEdges; -} -.mermaid .grid path { - stroke-width: 0; -} -/* Today line */ -.mermaid .today { - fill: none; - stroke: red; - stroke-width: 2px; -} -/* Task styling */ -/* Default task */ -.mermaid .task { - stroke-width: 2; -} -.mermaid .taskText { - text-anchor: middle; - font-size: 11px; -} -.mermaid .taskTextOutsideRight { - fill: black; - text-anchor: start; - font-size: 11px; -} -.mermaid .taskTextOutsideLeft { - fill: black; - text-anchor: end; - font-size: 11px; -} -/* Specific task settings for the sections*/ -.mermaid .taskText0, -.mermaid .taskText1, -.mermaid .taskText2, -.mermaid .taskText3 { - fill: white; -} -.mermaid .task0, -.mermaid .task1, -.mermaid .task2, -.mermaid .task3 { - fill: #8a90dd; - stroke: #534fbc; -} -.mermaid .taskTextOutside0, -.mermaid .taskTextOutside2 { - fill: black; -} -.mermaid .taskTextOutside1, -.mermaid .taskTextOutside3 { - fill: black; -} -/* Active task */ -.mermaid .active0, -.mermaid .active1, -.mermaid .active2, -.mermaid .active3 { - fill: #bfc7ff; - stroke: #534fbc; -} -.mermaid .activeText0, -.mermaid .activeText1, -.mermaid .activeText2, -.mermaid .activeText3 { - fill: black !important; -} -/* Completed task */ -.mermaid .done0, -.mermaid .done1, -.mermaid .done2, -.mermaid .done3 { - stroke: grey; - fill: lightgrey; - stroke-width: 2; -} -.mermaid .doneText0, -.mermaid .doneText1, -.mermaid .doneText2, -.mermaid .doneText3 { - fill: black !important; -} -/* Tasks on the critical line */ -.mermaid .crit0, -.mermaid .crit1, -.mermaid .crit2, -.mermaid .crit3 { - stroke: #ff8888; - fill: red; - stroke-width: 2; -} -.mermaid .activeCrit0, -.mermaid .activeCrit1, -.mermaid .activeCrit2, -.mermaid .activeCrit3 { - stroke: #ff8888; - fill: #bfc7ff; - stroke-width: 2; -} -.mermaid .doneCrit0, -.mermaid .doneCrit1, -.mermaid .doneCrit2, -.mermaid .doneCrit3 { - stroke: #ff8888; - fill: lightgrey; - stroke-width: 2; - cursor: pointer; - shape-rendering: crispEdges; -} -.mermaid .doneCritText0, -.mermaid .doneCritText1, -.mermaid .doneCritText2, -.mermaid .doneCritText3 { - fill: black !important; -} -.mermaid .activeCritText0, -.mermaid .activeCritText1, -.mermaid .activeCritText2, -.mermaid .activeCritText3 { - fill: black !important; -} -.mermaid .titleText { - text-anchor: middle; - font-size: 18px; - fill: black; -} -.mermaid g.classGroup text { - fill: #9370DB; - stroke: none; - font-family: 'trebuchet ms', verdana, arial; - font-size: 10px; -} -.mermaid g.classGroup rect { - fill: #ECECFF; - stroke: #9370DB; -} -.mermaid g.classGroup line { - stroke: #9370DB; - stroke-width: 1; -} -.mermaid svg .classLabel .box { - stroke: none; - stroke-width: 0; - fill: #ECECFF; - opacity: 0.5; -} -.mermaid svg .classLabel .label { - fill: #9370DB; - font-size: 10px; -} -.mermaid .relation { - stroke: #9370DB; - stroke-width: 1; - fill: none; -} -.mermaid .composition { - fill: #9370DB; - stroke: #9370DB; - stroke-width: 1; -} -.mermaid #compositionStart { - fill: #9370DB; - stroke: #9370DB; - stroke-width: 1; -} -.mermaid #compositionEnd { - fill: #9370DB; - stroke: #9370DB; - stroke-width: 1; -} -.mermaid .aggregation { - fill: #ECECFF; - stroke: #9370DB; - stroke-width: 1; -} -.mermaid #aggregationStart { - fill: #ECECFF; - stroke: #9370DB; - stroke-width: 1; -} -.mermaid #aggregationEnd { - fill: #ECECFF; - stroke: #9370DB; - stroke-width: 1; -} -.mermaid #dependencyStart { - fill: #9370DB; - stroke: #9370DB; - stroke-width: 1; -} -.mermaid #dependencyEnd { - fill: #9370DB; - stroke: #9370DB; - stroke-width: 1; -} -.mermaid #extensionStart { - fill: #9370DB; - stroke: #9370DB; - stroke-width: 1; -} -.mermaid #extensionEnd { - fill: #9370DB; - stroke: #9370DB; - stroke-width: 1; -} -.mermaid .node text { - font-family: 'trebuchet ms', verdana, arial; - font-size: 14px; -} -.mermaid div.mermaidTooltip { - position: absolute; - text-align: center; - max-width: 200px; - padding: 2px; - font-family: 'trebuchet ms', verdana, arial; - font-size: 12px; - background: #ffffde; - border: 1px solid #aaaa33; - border-radius: 2px; - pointer-events: none; - z-index: 100; -} diff --git a/src/bin/mdbook-mermaid.rs b/src/bin/mdbook-mermaid.rs index 24b999d..cb95070 100644 --- a/src/bin/mdbook-mermaid.rs +++ b/src/bin/mdbook-mermaid.rs @@ -13,11 +13,9 @@ use std::{ const MERMAID_JS: &[u8] = include_bytes!("assets/mermaid.min.js"); const MERMAID_INIT_JS: &[u8] = include_bytes!("assets/mermaid-init.js"); -const MERMAID_CSS: &[u8] = include_bytes!("assets/mermaid.css"); const MERMAID_FILES: &[(&str, &[u8])] = &[ ("mermaid.min.js", MERMAID_JS), ("mermaid-init.js", MERMAID_INIT_JS), - ("mermaid.css", MERMAID_CSS), ]; pub fn make_app() -> App<'static, 'static> { @@ -156,29 +154,15 @@ graph TD; fn add_additional_files(doc: &mut Document) -> bool { let mut changed = false; - let mut printed = true; - - let file = "mermaid.css"; - let additional_css = additional(doc, "css"); - if has_file(&additional_css, file) { - log::debug!("'{}' already in 'additional-css'. Skipping", file) - } else { - printed = true; - log::info!("Adding additional files to configuration"); - log::debug!("Adding '{}' to 'additional-css'", file); - insert_additional(doc, "css", file); - changed = true; - } + let mut printed = false; let file = "mermaid.min.js"; let additional_js = additional(doc, "js"); if has_file(&additional_js, file) { log::debug!("'{}' already in 'additional-js'. Skipping", file) } else { - if !printed { - printed = true; - log::info!("Adding additional files to configuration"); - } + printed = true; + log::info!("Adding additional files to configuration"); log::debug!("Adding '{}' to 'additional-js'", file); insert_additional(doc, "js", file); changed = true; -- cgit v1.2.3