Open cristianofromagio opened 2 years ago
Hi @cristianofromagio this is a great idea! Would be awesome if you had the time to do that!
Hello @bobbyiliev, it is me again! Sorry for the super late get back to this feature but you know, life gets in the way sometimes...
Anyways, I've been tinkering with a solution for this and now gonna list what I've managed to get sorted. First of all, this was really fun to research and build until now!
I've set that this feature should at least be able to be somewhat automated, meaning we should be doing the bare minimal of manual setting.
From Carbon not working out, I've come across Torchlight on the Laravel Docs website footer. After reading the docs for a bit, I found they had a themsaid/ibis
plugin to automatically convert markdown code blocks from e-book content files into highlighted code blocks on the PDF output.
shell
as language syntax.ibis build
to display the terminal window bar but never got to get it working, mainly because of mPDF
limitations (mPDF being the package ibis
uses to transform HTML into PDF). I tried CSS solutions like pseudo elements, border-images and background-images, all of which had little to no support.The styling issues faced from Torchlight-ibis
made me look for other code syntax highlight solutions, and that is when I ended up finding PrismJS.
ibis
project because it uses league/commonmark
for markdown rendering and scrivo/highlight.php
for code syntax highlight (both from spatie/commonmark-highlighter
), in other words, it was a PHP tooling, not a JS one.mPDF
(yep, this one again). mPDF
doesn't support some SVG properties exported by dom-to-svg
, so the images where all messed up on the PDF output. After that I would go on a quest to replace ibis
's mPDF
dependency with something else (TCPDF
) only to find out its CSS support was even lesser than mPDF
.After all this report, what I got to say is that I don't know how to finish this feature. My main suggestion is that we generate the terminal output images using the Prism project I made, replace the old images with the new styled ones and then run the PDF through PDF OCR so we can have the styling without losing the functionality of selecting the text.
My question now is: what do? How can we finish this feature? I'm gonna need some help with this. I could make the Marked+Prism little project available or incorporate it inside the project. Or just create the images and we get going. What do you think is the best for the project? @bobbyiliev
And again, sorry for the late feedback. This was really fun to piece together!
You are an absolute legend @cristianofromagio! Thank you so much for putting this together! I will use this as a blueprint and take it from here!
Is your feature request related to a problem? Please describe.
The screenshots of the terminal output, although it serves it purpose (to display a real example), seems a little out of place. To attribute a familiar design to it (like a window frame) might be easier for the reader to situate itself.
Describe the solution you'd like
We may use a tool like https://carbon.now.sh/ to generate images from the text in the current screenshots. We can customize font family, font size, colors and even syntax highlight (although for terminal "output" it might be a bit wrong when using ie.
bash
oupowershell
as language option).Additional context
A simple example for:
Currently
Carbon generated
If you consider replacing the images like so, I volunteer to generate them and PR the new ones.