diff options
| author | Albert Krewinkel <[email protected]> | 2025-05-28 11:10:51 +0200 |
|---|---|---|
| committer | Albert Krewinkel <[email protected]> | 2025-05-28 13:19:01 +0200 |
| commit | ce5e2a2efc0823833040f917d4470da82b634c13 (patch) | |
| tree | 060834c00de6412a0ea69b8fdc3f89939aec520d /doc | |
| parent | ccc0a5a630df414a580c5c58f1b0ad8133e1a398 (diff) | |
Lua: add function `pandoc.mediabag.make_data_uri`.
The function takes a MIME type and raw data from which it creates an
RFC 2397 data URI.
Closes: #10876
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/lua-filters.md | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/doc/lua-filters.md b/doc/lua-filters.md index 9a29732d9..b2ad38ad5 100644 --- a/doc/lua-filters.md +++ b/doc/lua-filters.md @@ -4532,6 +4532,38 @@ Returns: *Since: 2.0* +### make_data_uri {#pandoc.mediabag.make_data_uri} + +`make_data_uri (mime_type, raw_data)` + +Convert the input data into a data URI as defined by RFC 2397. + +Example: + + -- Embed an unofficial pandoc logo + local pandoc_logo_url = 'https://raw.githubusercontent.com/' + .. 'tarleb/pandoc-logo/main/pandoc.svg' + + local datauri = pandoc.mediabag.make_data_uri( + pandoc.mediabag.fetch(pandoc_logo_url) + ) + + local image = pandoc.Image('Logo', datauri) + +Parameters: + +`mime_type` +: MIME type of the data (string) + +`raw_data` +: data to encode (string) + +Returns: + +- data uri (string) + +*Since: 3.7.1* + ### write {#pandoc.mediabag.write} `write (dir[, fp])` |
