Skip to content

Commit

Permalink
Allow pdf and revealjs use a non-named argument. Add options to docum…
Browse files Browse the repository at this point in the history
…entation.
  • Loading branch information
coatless committed Feb 15, 2024
1 parent a78fa91 commit b80b43b
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
4 changes: 3 additions & 1 deletion _extensions/embedio/pdf.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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%"

Expand Down
3 changes: 2 additions & 1 deletion _extensions/embedio/revealjs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions docs/qembedio-embed-pdf.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -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`
8 changes: 8 additions & 0 deletions docs/qembedio-embed-revealjs.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -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`

0 comments on commit b80b43b

Please sign in to comment.