diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ed51738 --- /dev/null +++ b/Makefile @@ -0,0 +1,6 @@ +clean: + rm -rf docs/* + +move: + mv *.html docs/ + diff --git a/README.md b/README.md index 32237cc..b0ed67d 100644 --- a/README.md +++ b/README.md @@ -26,14 +26,14 @@ If you're using version control, you will want to check in this directory. This filter provides the following options, -| Option | Description | -|----------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `header` | A simple header text to appear in the top part of the each slide. `header` can be overridden by `title-as-header` or `subtitle-as-header` or slide specific header. | -| `header-logo` | A path for logo image which will appear on the top-left corner of each slide. | -| `sc-sb-title` | `true` or `false`. Specifies whether level1 (`h1`) and level2 (`h2`) slide titles should appear in the slide header automatically when `slide-level` is 2 or 3. | -| `tilte-as-header` | `true` or `false`. Specifies whether the Slide title should appear as the slide header automatically. Will override the `header` text. | -| `subtitle-as-header` | `true` or `false`. Specifies whether the Slide subtitle should appear in the slide header automatically. Will ovverride the `title-as-header`. | - +| Option | Description | +|------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `header` | A simple header text to appear in the top part of the each slide. `header` can be overridden by `title-as-header` or `subtitle-as-header` or slide specific header. | +| `header-logo` | A path for logo image which will appear on the top-left corner of each slide. | +| `sc-sb-title` | `true` or `false`. Specifies whether level1 (`h1`) and level2 (`h2`) slide titles should appear in the slide header automatically when `slide-level` is 2 or 3. | +| `tilte-as-header` | `true` or `false`. Specifies whether the Slide title should appear as the slide header automatically. Will override the `header` text. | +| `subtitle-as-header` | `true` or `false`. Specifies whether the Slide subtitle should appear in the slide header automatically. Will override the `title-as-header`. | +| `hide-from-titleSlide` | Use `"text"` to remove the header text from title Slide, `"logo"` to remove the logo from top-left corner of header on the title Slide, `"all"` to remove both text and logo from the header on title Slide. | Therefore an example could be, @@ -120,3 +120,5 @@ Also, to change the header text style for slides with simple [`background`](http - The source code for another example that uses all the options: [example_all.qmd](example_all.qmd) and the live demo of the rendered revealjs slides, [`example_all.html`](https://shafayetshafee.github.io/reveal-header/example_all.html) - The source code for another example that uses only `sc-sb-title`: [example_section-title.qmd](example_section-title.qmd) and the live demo of the rendered revealjs slides, [`example_section_title.html`](https://shafayetshafee.github.io/reveal-header/example_section_title.html) + +- The source code for example where header text is hidden on the title slide: [example_hide_header_text.qmd](example_hide_header_text.qmd) and the [`rendered output`](https://shafayetshafee.github.io/reveal-header/example_hide_header_text.html) diff --git a/_extensions/reveal-header/_extension.yml b/_extensions/reveal-header/_extension.yml index f0df1b8..698b774 100644 --- a/_extensions/reveal-header/_extension.yml +++ b/_extensions/reveal-header/_extension.yml @@ -1,6 +1,6 @@ title: Reveal-header author: Shafayet Khan Shafee -version: 1.2.4 +version: 1.2.5 quarto-required: ">=1.2.0" contributes: filters: diff --git a/_extensions/reveal-header/resources/js/add_header.js b/_extensions/reveal-header/resources/js/add_header.js index 2deaccf..51726a3 100644 --- a/_extensions/reveal-header/resources/js/add_header.js +++ b/_extensions/reveal-header/resources/js/add_header.js @@ -47,6 +47,16 @@ function header() { }; }; + function hide_from_title_slide(element) { + Reveal.on( 'slidechanged' , event => { + if (event.currentSlide.matches('#title-slide')) { + element.style.visibility = 'hidden'; + } else { + element.style.visibility = 'visible'; + } + }); + }; + if (Reveal.isReady()) { @@ -87,25 +97,30 @@ function header() { change_header(dyn_header, header_text, header_inner_html); }); - /************** header text in title slide if title or ******/ - /************* subtitle is used as header text ******/ - + /************** header text in title slide if title or ***********************/ + /************* subtitle is used as header text ***********************/ var title_text = document.querySelector('.reveal-header .title-text p'); - if (title_text != null) { - - title_text.style.display = 'none'; - - Reveal.on( 'slidechanged' , event => { - if (event.currentSlide.matches('#title-slide')) { - title_text.style.display = 'none'; - } else { - title_text.style.display = 'block'; - } - }); + title_text.style.visibility = 'hidden'; + hide_from_title_slide(title_text); }; + /*************** hide header text and logo on title slide ********************/ + + var hide_header_text = document.querySelector('.header-text').getAttribute('data-hide-from-titleslide'); + var hide_header_logo = document.querySelector('.header-logo').getAttribute('data-hide-from-titleslide'); + + if (hide_header_text == 'true') { + header_text.style.visibility = 'hidden'; + hide_from_title_slide(header_text); + } + + if (hide_header_logo == 'true') { + logo_img.style.visibility = 'hidden'; + hide_from_title_slide(logo_img); + } + }; }; diff --git a/_extensions/reveal-header/reveal-header.lua b/_extensions/reveal-header/reveal-header.lua index fb25679..a0733b8 100644 --- a/_extensions/reveal-header/reveal-header.lua +++ b/_extensions/reveal-header/reveal-header.lua @@ -72,6 +72,17 @@ if quarto.doc.is_format('revealjs') then local header_section = pandoc.Div(pandoc.Para(" "), {class = "sc-title"}) local header_sbsection = pandoc.Div(pandoc.Para(" "), {class = "sb-title"}) local header_para = pandoc.Div(pandoc.Para(header_text), header_para_class) + if meta['hide-from-titleSlide'] then + local hide = str(meta['hide-from-titleSlide']) + if hide == "text" then + header_para.attributes['hide-from-titleslide'] = "true" + elseif hide == "logo" then + header_img.attributes['hide-from-titleslide'] = "true" + elseif hide == "all" then + header_para.attributes['hide-from-titleslide'] = "true" + header_img.attributes['hide-from-titleslide'] = "true" + end + end local div = pandoc.Div( { header_img, diff --git a/docs/example.html b/docs/example.html index b47fdeb..c81287e 100644 --- a/docs/example.html +++ b/docs/example.html @@ -1,12 +1,12 @@ +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ClipboardJS=e():t.ClipboardJS=e()}(this,function(){return n={686:function(t,e,n){"use strict";n.d(e,{default:function(){return b}});var e=n(279),i=n.n(e),e=n(370),u=n.n(e),e=n(817),r=n.n(e);function c(t){try{return document.execCommand(t)}catch(t){return}}var a=function(t){t=r()(t);return c("cut"),t};function o(t,e){var n,o,t=(n=t,o="rtl"===document.documentElement.getAttribute("dir"),(t=document.createElement("textarea")).style.fontSize="12pt",t.style.border="0",t.style.padding="0",t.style.margin="0",t.style.position="absolute",t.style[o?"right":"left"]="-9999px",o=window.pageYOffset||document.documentElement.scrollTop,t.style.top="".concat(o,"px"),t.setAttribute("readonly",""),t.value=n,t);return e.container.appendChild(t),e=r()(t),c("copy"),t.remove(),e}var f=function(t){var e=1 + - + - + Quarto Presentations @@ -601,9 +617,9 @@ ul.task-list{list-style: none;} ul.task-list li input[type="checkbox"] { width: 0.8em; -margin: 0 0.8em 0.2em -1.6em; -vertical-align: middle; +margin: 0 0.8em 0.2em -1em; vertical-align: middle; } + pre > code.sourceCode { white-space: pre; position: relative; } pre > code.sourceCode > span { display: inline-block; line-height: 1.25; } pre > code.sourceCode > span:empty { height: 1.2em; } @@ -669,7 +685,7 @@ code span.vs { color: #20794d; } code span.wa { color: #5e5e5e; font-style: italic; } - + @@ -1333,7 +1350,7 @@

Quarto Presentations

-

16 Feb, 2023

+

19 Apr, 2023

Hello, There

@@ -1883,6 +1900,9 @@

Line Highlighting

Reveal = _Reveal; install(); }; + Plugin.togglePdfExport = function () { + togglePdfExport(); + }; } return Plugin; @@ -1930,6 +1950,9 @@

Line Highlighting

downloadDrawings: revealMenuToolHandler(function () { RevealChalkboard.download(); }), + togglePdfExport: revealMenuToolHandler(function () { + PdfExport.togglePdfExport(); + }), }; +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ClipboardJS=e():t.ClipboardJS=e()}(this,function(){return n={686:function(t,e,n){"use strict";n.d(e,{default:function(){return b}});var e=n(279),i=n.n(e),e=n(370),u=n.n(e),e=n(817),r=n.n(e);function c(t){try{return document.execCommand(t)}catch(t){return}}var a=function(t){t=r()(t);return c("cut"),t};function o(t,e){var n,o,t=(n=t,o="rtl"===document.documentElement.getAttribute("dir"),(t=document.createElement("textarea")).style.fontSize="12pt",t.style.border="0",t.style.padding="0",t.style.margin="0",t.style.position="absolute",t.style[o?"right":"left"]="-9999px",o=window.pageYOffset||document.documentElement.scrollTop,t.style.top="".concat(o,"px"),t.setAttribute("readonly",""),t.value=n,t);return e.container.appendChild(t),e=r()(t),c("copy"),t.remove(),e}var f=function(t){var e=1 + - + - + Quarto Presentations @@ -696,11 +712,10 @@ ul.task-list{list-style: none;} ul.task-list li input[type="checkbox"] { width: 0.8em; -margin: 0 0.8em 0.2em -1.6em; -vertical-align: middle; +margin: 0 0.8em 0.2em -1em; vertical-align: middle; } - + @@ -1364,7 +1380,7 @@

Quarto Presentations

-

18 Feb, 2023

+

19 Apr, 2023

@@ -1918,6 +1934,9 @@

2.2.1 TODO

Reveal = _Reveal; install(); }; + Plugin.togglePdfExport = function () { + togglePdfExport(); + }; } return Plugin; @@ -1965,6 +1984,9 @@

2.2.1 TODO

downloadDrawings: revealMenuToolHandler(function () { RevealChalkboard.download(); }), + togglePdfExport: revealMenuToolHandler(function () { + PdfExport.togglePdfExport(); + }), }; + + + + + + + + + + + + + Quarto Presentations + + + + + + + + + + + + + + + +
+
+ +
+

Quarto Presentations

+

Create beautiful interactive slide decks with Reveal.js

+ +
+
+
+Shafayet Khan Shafee +
+
+
+ +

19 Apr, 2023

+
+
+

Hello, There

+

This presentation shows a few slides made by Quarto and Reveal.js along with header logo and header text which are easily embedded by using the Quarto filter reveal-header

+
+
+

Slide Backgrounds

+

This slide is created using the background attribute ({background="#43464B"}) and as you can see that header text color is different (difference is trivial though) than before.

+

if you want you can change the color of the header text for slides with background attribute using css class .inverse-header. For example,

+
.inverse-header {
+  color: #c1c1c1 !important;
+}
+

Here using !important is important :p.

+ +
+
+

Slide Backgrounds

+
+

Slide with bg color #43464B, used in .inverse-header

+
+

This slide contains a header div, therefore it has a header.

+ +
+
+

Executable Code

+
+

Codes with syntax highlighting and line numbers.

+
+
+
library(ggplot2)
+ggplot(mtcars, aes(hp, mpg, color = am)) +
+  geom_point() +
+  geom_smooth(formula = y ~ x, method = "loess")
+
+ +
+
+

Line Highlighting

+
+

Codes with specific line highlighted

+
+
import numpy as np
+import matplotlib.pyplot as plt
+
+r = np.arange(0, 2, 0.01)
+theta = 2 * np.pi * r
+fig, ax = plt.subplots(subplot_kw={'projection': 'polar'})
+ax.plot(theta, r)
+ax.set_rticks([0.5, 1, 1.5, 2])
+ax.grid(True)
+plt.show()
+ +

+ +
+ +
+

+
+
+

Quarto Presentations with beautiful slide decks made by RevealJs

+
+
+

+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/example_section_title.html b/docs/example_section_title.html index 9112acb..09b35ea 100644 --- a/docs/example_section_title.html +++ b/docs/example_section_title.html @@ -1,12 +1,12 @@ +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ClipboardJS=e():t.ClipboardJS=e()}(this,function(){return n={686:function(t,e,n){"use strict";n.d(e,{default:function(){return b}});var e=n(279),i=n.n(e),e=n(370),u=n.n(e),e=n(817),r=n.n(e);function c(t){try{return document.execCommand(t)}catch(t){return}}var a=function(t){t=r()(t);return c("cut"),t};function o(t,e){var n,o,t=(n=t,o="rtl"===document.documentElement.getAttribute("dir"),(t=document.createElement("textarea")).style.fontSize="12pt",t.style.border="0",t.style.padding="0",t.style.margin="0",t.style.position="absolute",t.style[o?"right":"left"]="-9999px",o=window.pageYOffset||document.documentElement.scrollTop,t.style.top="".concat(o,"px"),t.setAttribute("readonly",""),t.value=n,t);return e.container.appendChild(t),e=r()(t),c("copy"),t.remove(),e}var f=function(t){var e=1 + - + - + Quarto Presentations @@ -696,11 +712,10 @@ ul.task-list{list-style: none;} ul.task-list li input[type="checkbox"] { width: 0.8em; -margin: 0 0.8em 0.2em -1.6em; -vertical-align: middle; +margin: 0 0.8em 0.2em -1em; vertical-align: middle; } - + @@ -1939,6 +1955,9 @@

2.2.2 TODO

Reveal = _Reveal; install(); }; + Plugin.togglePdfExport = function () { + togglePdfExport(); + }; } return Plugin; @@ -1986,6 +2005,9 @@

2.2.2 TODO

downloadDrawings: revealMenuToolHandler(function () { RevealChalkboard.download(); }), + togglePdfExport: revealMenuToolHandler(function () { + PdfExport.togglePdfExport(); + }), };