From b80b43bd2305795d61f091e99c30126f9af2c17d Mon Sep 17 00:00:00 2001 From: James J Balamuta Date: Thu, 15 Feb 2024 07:12:50 +0000 Subject: [PATCH] Allow pdf and revealjs use a non-named argument. Add options to documentation. --- _extensions/embedio/pdf.lua | 4 +++- _extensions/embedio/revealjs.lua | 3 ++- docs/qembedio-embed-pdf.qmd | 9 +++++++++ docs/qembedio-embed-revealjs.qmd | 8 ++++++++ 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/_extensions/embedio/pdf.lua b/_extensions/embedio/pdf.lua index cc4a7b3..06ac62f 100644 --- a/_extensions/embedio/pdf.lua +++ b/_extensions/embedio/pdf.lua @@ -5,7 +5,9 @@ local function pdf(args, kwargs, meta) end -- Supported options for now - local pdf_file_name = pandoc.utils.stringify(kwargs["file"]) + local pdf_file_name = args[1] or kwargs["file"] + pdf_file_name = pandoc.utils.stringify(pdf_file_name) + local height = pandoc.utils.stringify(kwargs["height"]) or "600px" local width = pandoc.utils.stringify(kwargs["height"]) or "100%" diff --git a/_extensions/embedio/revealjs.lua b/_extensions/embedio/revealjs.lua index 094bbea..9a2d83e 100644 --- a/_extensions/embedio/revealjs.lua +++ b/_extensions/embedio/revealjs.lua @@ -34,7 +34,8 @@ local function revealjs(args, kwargs, meta , raw_args) ensureSlideCSSPresent() -- Supported options for now - local slide_file_name = pandoc.utils.stringify(kwargs["file"]) + local slide_file_name = args[1] or kwargs["file"] + slide_file_name = pandoc.utils.stringify(slide_file_name) local height = pandoc.utils.stringify(kwargs["height"]) or "475px" -- HTML block diff --git a/docs/qembedio-embed-pdf.qmd b/docs/qembedio-embed-pdf.qmd index 741c107..ff01b83 100644 --- a/docs/qembedio-embed-pdf.qmd +++ b/docs/qembedio-embed-pdf.qmd @@ -12,3 +12,12 @@ For example, we can show the `test.pdf` with: {{< pdf file="assets/test.pdf" >}} +## Options + +| Keyword Argument | Default Value | Description | +|-------------------|---------------|----------------------------------------------------------| +| `file` | None | Specifies the input PDF file path. | +| `height` | "600px" | Specifies the height of the embedded PDF object. | +| `width` | "100%" | Specifies the width of the embedded PDF object. | + +You may also omit specifying a `file` option. We'll automatically use the first parameter as the `file` \ No newline at end of file diff --git a/docs/qembedio-embed-revealjs.qmd b/docs/qembedio-embed-revealjs.qmd index 98bc516..96bd906 100644 --- a/docs/qembedio-embed-revealjs.qmd +++ b/docs/qembedio-embed-revealjs.qmd @@ -12,3 +12,11 @@ For example, we can show the `slides-reveal.html` with: {{< revealjs file="assets/slides-reveal.html" >}} +## Options + +| Keyword Argument | Default Value | Description | +|-------------------|---------------|----------------------------------------------------------| +| `file` | None | Specifies the input file path for the Reveal.js slides. | +| `height` | "475px" | Specifies the height of the embedded slide deck. | + +You may also omit specifying a `file` option. We'll automatically use the first parameter as the `file` \ No newline at end of file