Code Monkey home page Code Monkey logo

reveal-header's Introduction

Reveal-header Extension For Quarto

A very simple Quarto filter extension for revealjs output format that provides

  • Support for adding header text like footer on slides, level1 (h1) and level2 (h2) slide titles on slide header,

  • Another YAML option to add a logo on top-left side of each slides. So by using this filter, it is possible to use two logos for each slides (One by using the default logo option which adds the logo on bottom-right corner and another one by using header-logo option provided by this filter.)

  • Provides YAML option header-logo-link and footer-logo-link to hyperlink the header logo and footer logo respectively.

View the Demos of using this filter,

Installing

โš ๏ธ This extension requires Quarto version to be at least 1.2

quarto add shafayetShafee/reveal-header

This will install the extension under the _extensions subdirectory. If you're using version control, you will want to check in this directory.

Using

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.
header-logo-link A link in quotes for the header logo.
footer-logo-link A link in quotes for the footer logo.
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.
title-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,

---
title: "Quarto Presentations"
format:
  revealjs:
    slide-number: true
    logo: images/quarto.png
    footer: <https://quarto.org>
    header: Quarto Presentations with beautiful slide decks made by RevealJs
    header-logo: images/reveal_logo.svg
filters:
  - reveal-header
---


## Slides

Then the text Quarto Presentations with beautiful slide decks made by RevealJs will appear on the top margin of each slides (unless you use slide specific custom header) and similarly, the added logo will appear on top-left corner of each slide.

So the Title slide for the above example looks like,


Title Slide

You can also include a custom header per-slide by adding a header div at the bottom of the the slide, as following,

## Slide

::: header

Custom Header

:::

Another example that uses all of the options,

---
format: 
  revealjs:
    slide-number: true
    logo: images/quarto.png
    sc-sb-title: true
    header: Quarto Presentations with beautiful slide decks made by RevealJs
    header-logo: images/reveal_logo.svg
    subtitle-as-header: true
    footer: <https://quarto.org>
filters: 
  - reveal-header
slide-level: 3
number-sections: true
---

For a complete example with the live demo of the rendered output, see below.

Styling

Now to change the style of header components (i.e. logo, section and subsection title, header text), you can use the following css selectors,

  • .reveal-header .header-logo: to change css properties of header image.
  • .reveal-header .header-text: to change the styles of header text.
  • .reveal-header .sc-title: to change the styles of section title on left side.
  • .reveal-header .sb-title: to change the styles of sub-section title on right side.

Also, to change the header text style for slides with simple background attributes, use the css selector.reveal-header .inverse-header.

Example

reveal-header's People

Contributors

andrewpbray avatar shafayetshafee avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

reveal-header's Issues

Current section and subsection in the header

Hello,

Thank you for this useful extension.

I would like to put the current section (h1) and subsection (h2) of a presentation a the top of the slide (h3), the slide title being just underneath. See screenshot below as an illustration of what I would like to achieve.

Your extension seems to be build for this kind of usage.
Is it possible to do this with your extension ?

Thanks for your feedback and for reveal-header.
Regards

image

Implement adding link on logo

Implement the following from here,

You can write a JavaScript function to take the rendered logo image and then nest it withing an a tag with the desired hyperlink.

logo-hyperlink.html

<script type="text/javascript">
  function hyperlink_logo() {
    let logo = document.querySelector('img.slide-logo');
    const logo_cloned = logo.cloneNode(true);
    const link = document.createElement('a');
    // -----------------------------------------------------------
    // set the link for the logo here in `link.href` within quotes
    link.href = 'https://stackoverflow.com';
    // -----------------------------------------------------------
    link.target = '_blank';
    link.appendChild(logo_cloned);
    logo.replaceWith(link);
  };
  
  window.document.addEventListener("DOMContentLoaded", function (event) {
    hyperlink_logo();
  });
</script>

Set the link enclosed with quotes for the logo as the value of link.href. And then include this html file to the qmd file.

presentation.qmd

---
title: Testing
format:
    revealjs:
      logo: SO.png
include-after-body: logo-hyperlink.html
---


## Quarto

embed-resources results in bug

Hi,

if you use embed-resources: true, the logo behaves very irrationally:

---
format:
  revealjs:
    slide-number: true
    footer: <https://quarto.org>
    header: Quarto Presentations with beautiful slide decks made by RevealJs
    header-logo: images/Vector-based_example.svg
    embed-resources: true
filters:
  - reveal-header
---

image

Hide Header on Title Slide

Hi.

Excellent work. Thank you.
I'd like to hide the header on the title slide (redundant information such as the author and title of the slide deck, otherwise).
Am I missing an option to do that?

Cheers,
Jens

Managing '_extensions' folder

Hi there. I love this little extension filter. However, I notice it works when the Quarto document I'm creating is in the root project directory, but it fails when the Quarto document lives in a deeper directory. Any advice on getting it to work in that case?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.