Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin only renders first page on PDF export #31

Open
shemraz opened this issue Oct 10, 2023 · 7 comments
Open

Plugin only renders first page on PDF export #31

shemraz opened this issue Oct 10, 2023 · 7 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@shemraz
Copy link

shemraz commented Oct 10, 2023

The plugin doesn't seem to be able to render multi-page documents. I'm rendering as SVG in the example, but it's the same with images!

Preamble

// typography
#set page(paper: "a4", fill: rgb("f7f9ff"), margin: 2.5cm, numbering: "1")
#set text(
	font: "Halant",
	size: 10pt,
	fill: rgb("5c6166")
)
#set par(justify: true, leading: 15pt)
#show heading: set text(
	font: "Montserrat",
	weight: "semibold"
	)
#show heading: set block(
	spacing: 15pt
	) 

// citations
#set cite(style: "chicago-notes", brackets: false)
#set bibliography(style: "chicago-author-date")
#show "“": "‘"
#show "”": "’"

Codeblock

= h1
== h2
#lorem(100)

== h2
#lorem(200)

== h2
#lorem(300)

= h1 
#lorem(100)

Intended result
Test.pdf

Actual Result
image

@fenjalien
Copy link
Owner

As this plugin is intended to only render code blocks and math blocks, it only makes sense to render the first page. Once a custom editor has been added multiple pages could be supported.

@fenjalien fenjalien added the enhancement New feature or request label Oct 17, 2023
@shemraz
Copy link
Author

shemraz commented Oct 18, 2023

Ah, I see. Understandable! Is there a planned implementation for the custom editor? I would love to contribute but am unfamiliar with Rust. The work you've put into this plugin is much appreciated!

@fenjalien
Copy link
Owner

An implementation is planned but its waiting on HTML export from typst as that would remove a lot of the headache. I think @SekoiaTree started looking into the impl. then switched to looking into the html export and then I lost track :)

@SekoiaTree
Copy link
Contributor

Haha yeah I've been relatively busy since sadly

@fenjalien fenjalien added the bug Something isn't working label Dec 12, 2023
@fenjalien fenjalien changed the title Plugin only renders first page Plugin only renders first page on PDF export Dec 12, 2023
@aczw
Copy link

aczw commented Feb 14, 2024

hi! so just to clarify, I have a bunch of math blocks interspersed with standard Obsidian text. when I export to PDF, my content is longer than 1 page, and so only the math blocks on the first page are rendered, the rest are not. this is currently expected behavior, right? thank you!

@fenjalien
Copy link
Owner

@aczw I think your problem is closer to #29 than this one.

when I export to PDF, my content is longer than 1 page, and so only the math blocks on the first page are rendered, the rest are not. this is currently expected behavior, right?

In a way it is expected behaviour but it is still a problem that should be fixed. Its most likely because Obsidian expects the renderMath function to be blocking (when it returns it is completely done). However, the plugin overrides this and the function is async/nonblocking so it returns before it is "done rendering". I'm not entirely sure how to fix this and honestly I need to find a better way to override the default math blocks.

As a work around you try using pandoc to convert the markdown into Typst...

@aczw
Copy link

aczw commented Feb 16, 2024

ah that issue more closely describes what I'm experiencing. I'm not in a hurry to export my notes or anything, but I'll try using pandoc, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants