diff --git a/book-example/book.toml b/book-example/book.toml index 4679a3a2..da7da92b 100644 --- a/book-example/book.toml +++ b/book-example/book.toml @@ -4,4 +4,5 @@ author = "Mathieu David" [output.html] additional-css = ["my_custom.css"] +additional-js = ["my_custom.js"] mathjax-support = true diff --git a/book-example/my_custom.css b/book-example/my_custom.css new file mode 100644 index 00000000..b20aaf80 --- /dev/null +++ b/book-example/my_custom.css @@ -0,0 +1 @@ +.custom_border { border: 2px dotted #f00; padding: 6px; } diff --git a/book-example/my_custom.js b/book-example/my_custom.js new file mode 100644 index 00000000..ca67b927 --- /dev/null +++ b/book-example/my_custom.js @@ -0,0 +1,12 @@ +(function() { +// register a function run when the page is loaded completely +document.addEventListener('DOMContentLoaded', function() { + // we extend all elements with class="custom_border" with a little text + var divs = document.querySelectorAll('.custom_border'); + divs.forEach(function(e) { + try { + e.innerHTML += ' - extended with JavaScript'; + } catch (e) {} + }); +}, false,); +})(); diff --git a/book-example/src/format/config.md b/book-example/src/format/config.md index aa8a107e..67a833cc 100644 --- a/book-example/src/format/config.md +++ b/book-example/src/format/config.md @@ -19,8 +19,6 @@ destination = "my-example-book" additional-css = ["my_custom.css"] ``` -