Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions default/templates/filters/embed-pdf.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<object class="mb-3 embedded-pdf w-full" type="application/pdf" data="${ema:url}"
style="height: 800px">
<a href="${ema:url}">Open pdf</a>
</object>
7 changes: 7 additions & 0 deletions docs/demo/embed.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,10 @@ It is also posible to add images inline (example, here's the site favicon: [![[f
The following is the result of using `![[death-note.mp4]]`.

![[death-note.mp4]]


### PDFs

PDFs can be embedded using the same syntax; ie. `![[git-cheat-sheet-education.pdf]]` will show:

![[git-cheat-sheet-education.pdf]]
Binary file added docs/demo/git-cheat-sheet-education.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion emanote.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 2.4
name: emanote
version: 0.7.8.2
version: 0.7.9.0
license: AGPL-3.0-only
copyright: 2021 Sridhar Ratnakumar
maintainer: srid@srid.ca
Expand Down
3 changes: 3 additions & 0 deletions src/Emanote/Pandoc/Renderer/Embed.hs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ embedStaticFileRoute model wl staticFile = do
| any (`T.isSuffixOf` toText fp) videoExts -> do
pure . runEmbedTemplate "video" $ do
"ema:url" ## HI.textSplice url
| ".pdf" `T.isSuffixOf` toText fp -> do
pure . runEmbedTemplate "pdf" $ do
"ema:url" ## HI.textSplice url
| otherwise -> Nothing

imageExts :: [Text]
Expand Down