twibiral / obsidian-execute-code

Obsidian Plugin to execute code in a note.
MIT License
1.15k stars 68 forks source link

[FR] Render executed code in PDF #57

Open twibiral opened 2 years ago

twibiral commented 2 years ago

Obsidian ignores the output blocks that contain the results of the execution. Is there some way to show them in the PDF?

chlohal commented 2 years ago

I stepped through the exporting with the debugger, and it seems like Obsidian re-renders the source markdown document for the PDF export. It calls the post-processing functions from registerMarkdownPostProcessor, though, so there's a possibility for showing output. Sorry!

mayurankv commented 1 year ago

I've seen one plugin use this to style pdf exports inside a markdown post processor:

const view = plugin.app.workspace.getActiveViewOfType(MarkdownView);
if (view && view.editor) {
    ...
} else {
    //PDF Export 
    ...
}

Not sure at all whether this is best practice though.