medium-converter
medium-converter copied to clipboard
Add images and code scripts
Most of the medium articles make heavy use of images and code snippets to describe concepts. Would it be possible add the images or media in general to the generated pdfs?
Yup, good idea !
Maybe I could try to do this, without breaking the building process this time x)
As far as I know, it is possible yes! PRs are welcome :-)
It would seem that medium-parser accepts images already so I guess we need to solve it at the markdown to pdf conversion.
We might need a new provider for this service.
After further tests, it seems that the problem with images doesnt come from docverter.
Here is a sample of the markdown produced by the parser:
Blockchain Is a New Model That Makes the Existing Model Obsolete
The geeks are building a new, digital substrate for the global economy

# Blockchain is a very strange thing — simultaneously the most overhyped, least understood and most disruptive technology of our time
Some say it’s the biggest change to finance since the invention of double-entry bookkeeping during the Renaissance. That solved the problem of merchants knowing whether they could trust their own books, and allowed entrepreneurs and investors to form corporations, paving the way for modern capitalism. However, a third, trusted party was still needed to verify that the information in the books was correct. Half a millennium later, blockchain adds another entry to the ledger: a verifiable cryptographic receipt of any transaction, paving the way for a fairer, safer and more transparent global financial system.
As you can see the image is not correctly generated:

Maybe we should rework the parser a bit ?
Hum... It seems that this bug doesnt occur every time.
I've achieved converting this page by switching to the markdowntopdf converter. It works pretty well with images and code samples !
Here is a sample of what it produces:
awselbandautoscalingusingterraform.pdf
The facts is that it only supports converting to pdf :/ Is this a problem ?
My code is here for now, I will rework it a bit.
Great that it worked!
Sounds good to me. For e-book formats, we should be able to transform the generated .pdf into .mobi and .epub.
Hi,

It's not an image error, this problem happens when there are gistfile mentioned.
Like this:
@gunar I really like your lib, it's very useful.
@Pettymn Hi Peterson, glad you like it. Can I ask you two small favors? 1. Open a separate issue for this bug. 2. Link to the exact post you're having trouble with. This will help us move forward. Thanks!
Done
@Clovis-Portron The issue with only some images being displayed is an issue with medium-parser. I opened an issue over there: gunar/medium-parser#13 that highlights the problem and a solution.
I am currently working on a PR to fix this! 👍
Also @Clovis-Portron where did you find the documentation for markdowntopdf? I have been looking for it and could only work out how to use it by looking at your code :joy:
@DanielArthurUK I do not think they provide any documentation, I've "reverse-engineered" how they use their own system when we press "Select a file" on this page. :P