Adding a simple image slide mechanism.

main
Zed A. Shaw 2 years ago
parent 514a628a4f
commit 8a0d89e63e
  1. 14
      commands/pdfpresgen.js
  2. 4
      scripts/pdfpres_example.md

@ -85,6 +85,17 @@ const write_page = (doc, template, content) => {
doc.list(content.slide_body, main_box.x, main_box.y, main_box);
} else if(content.type == "title-image") {
// it's a title only slide
doc.fontSize(80);
// add the title/body text
doc.font("heading").text(content.slide_title, main_title.x, main_title.y, main_title);
doc.image(content.slide_body, main_box.x, main_box.y, {
fit: [main_box.width, main_box.height],
align: "center",
valign: "center"
});
} else if(content.type == "title-only") {
// it's a title only slide
doc.fontSize(80);
@ -132,6 +143,9 @@ const parse_input = (input) => {
} else if(body.startsWith("*")) {
page.type = "title-bullets";
page.slide_body = body.split("\n").map(l => l.slice(1).trim());
} else if(body.startsWith("[")) {
page.type = "title-image";
page.slide_body = body.slice(1,-1);
} else {
page.type = "title-text";
}

@ -14,5 +14,9 @@ Another Thing
Then we'll have more to do, but for now we'll be able to do more things than this hopefully.
---
Image Slide
[static/images/zed.png]
---
Slide Title Only
---

Loading…
Cancel
Save