How to print/export with preview removed?

I print or export my notes quite often; A feature which has now been removed.
Any workarounds without having to manually copypaste everything in some external markdown converter?

I tried the browser print function which could be semi-acceptable but this only seems to print the first page

Thanks

How proficient are you in SpaceLua? I would use something like Pandoc together with this API.

Hi !

Do not about @Dollon , but SpaceLua I am not proefficient.
Based on my previous experience, pandoc was on a pain to install…

All this to express it is a bit bitty to not be able to export some of consolidated notes, sepcifically on a system orented in single user.

I tried to use the print command from the browser but it ends with only the first page printed and nothing else…

Hope someday it will be easier, for the moment I’m copy pasting my content to obsidian and then print it… through export to pdf.:neutral_face:

Here are some tips and instructions on how to use pandoc + weasyprint.

You can also refine the CSS to fit your needs.

I know pandoc & weasyprint it’s not the best solution, but I’m getting pretty good & consistent printouts with it.
Check out my library I prepared with some instructions. Depending on where your Silverbullet server ā€œlivesā€ installing pandoc could be a breeze or a pain in the a$$.

PDF_with_Pandoc_and_Weasyprint

And here are some resulting pages:

[EDIT] :skull_and_crossbones: The Pandoc&Weasyprint Library is deprecated and kept for reference only. Use the new ā€œPrintPreviewā€ instead :backhand_index_pointing_down:

Forget the last library using Pandoc and Weasyprint !!!

I could came up with a better and slimer solution without the need to install anything on the server side.

You can install it using the Library import: PrintPreview Library

or install ā€œPrintPreviewā€ directly from my Repo, if your are on Silverbullet 2.2.1-edge

When running the command make sure you have Pop-Up`s enabled !

The Sytling result is similar to the Pandoc&Weasyprint version but for this as mentioned before you don’t need to install anything on the server side. it’s just plain space-lua, CSS and HTML:




  • You have some configuration options which you can setup using config.set or even use your own CSS file if you want to tweak some values, or styles, paddings, colors, etc.
  • This Library will render your lua queries and also your markdown widgets
  • but sadly HTML widgets are not (yet?) supported.
1 Like

Just tried this briefly and worked as advertised! Still have to pull in a nicer CSS though.

Do you have any references on how it should look like, because in CSS (almost) everything is possible, and because i am recreating the PrinPreview HTML from scratch anything can be added or hidden (buttons, dark background etc.) to be more compatible with a printout.

I could also add multiple css files as print layout one can chose from, like themes for a UI.
Some layout might be optimized for Literature/Stories/Novels, other layout can be optimized for Tables and data, and other for code etc.

I just need a reference of what you have in mind how the print preview page should look like.
A simple image or screenshot es enough to recreate the CSS accordingly. there is also a possibility to do page breaks on either <hr> or before each <h1> - <h6> tag.

This way the possibilities are endless, and I also can see people doing their own css files and sharing them as layout themes.

I have nothing in mind other than that it should look nice :trade_mark:

1 Like

Ah, got it, that means I need to dive straight down the typography and calligraphy rabbit hole and come back with something solid. I’m talking fonts, line spacing, kerning, hierarchy, page layout, grids, and all the print-specific CSS tricks. Tables and code will need their own treatment too, alignment, spacing, monospace readability, maybe even subtle shading. Also I want the PrintPreview to reflect the printout as closely as possible.

Time to geek out and see how far I can push aesthetics and readability in HTML/CSS print!

but don’t expect one magic CSS to cover all these, diferent data/text needs different representation, there is no magical ā€˜silverbullet’ to do it all in one :wink: (pun intended)

PS: TBH It already looks & work0 better than just printing straight from the page itself :stuck_out_tongue:

As a side note, I’m looking forward to the day where you receive the Nobel prize for literature for your SilverBullet kitten short story.

3 Likes

:rofl:
I will have to share it with ChatGPT and all the sources it was trained on, so there won’t be much left for me.

Ah, tough luck. I think it’s well established already you cannot claim copyright on AI slop.

1 Like

I shared this Gist just for you :stuck_out_tongue: :backhand_index_pointing_right: The Silverbullet Kittens

1 Like

Important question: what’s up with that app on the screen there, is that ChatGPT’s vibed interpretation of what SilverBullet looks like?

The Silverbullet kittens used sone nasty space-style-s to redesign SB’s UI because they weren’t 100% happy of how it looked :squinting_face_with_tongue::winking_face_with_tongue:. Also if you look closely the top bar is Mac, and bottom dock/taskbar is Win/Linux.

BTW, that image: this time it was Grok, not ChatGPT :sweat_smile:

Updated my PrintPreview library.

Changes:

  • When you run the command, it will look for available *.css files in your space and asks you which one to use. You can add as many custom CSS’s as you want and chose from when previewing.
  • This update also comes with 3 different Stylesheets, which are optimised for:

classic.css - for narration, stories, prose, longer texts etc.

code.css - printing code, snippets, syntaxes etc.

data.css - tables and other data

  • if you want to change the colors of the css you can do this simply by changing the --hue variable in the :root of the CSS files. Here are the hue values for the 7 main colors:

    • Red: 25
    • Orange: 55
    • Yellow: 100
    • Green: 145
    • Blue: 255
    • Indigo: 275
    • Violet: 305

  • I’m considering adding this Choose Color option to the menu in future releases.

If you have any improvements or better implementations, or you just want to share your StyleSheets, leave a comment below.

4 Likes

Just added highlight.js codeblock syntax highlighting for PrintPreview:

here is screenshot:

Hello @Mr.Red , many thanks for this great library.

Is there any chance to have mermaid graph render :grin: ?
This would be very nice …

I’ll take a look at Marmaid.

Adding support for all kind of plugins, would complicate things quite a bit and require loading different JavaScript libraries depending on the template:

The Code template definitely needs highlight.js for syntax highlighting.
The Data template needs mermaid.js for diagrams, charts, flowcharts, etc.
The Classic template is just clean rendered Markdown - the simplest case.

My original goal was to keep everything as lightweight and self-contained as possible (Lua + HTML + CSS only), but we’re now stepping into JavaScript territory and pulling in external libraries.
I’m a bit concerned that if we try to support everything: Mermaid, Excalidraw, syntax highlighting, and potentially many more plugins, we’ll open Pandora’s box and end up with a huge, complex codebase. It’s definitely doable, but it risks turning into a maintenance nightmare.
So the real question is: where do we draw the line?

Should we keep things minimal and focused, or go all-in and build a full-featured renderer with plugin support?

Let me know your thoughts, but I’d like us to decide consciously rather than let it grow organically into a code monster.

could you define a service to allow people to inject mermaid.js handling (or other plugin support) inside the Data template? Then your library could just be the core functionality, and mermaid.js support could come from an independent library.

1 Like