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=116 Feb, 2023
+19 Apr, 2023