get rid of weird hidden images
This commit is contained in:
parent
b77384d8e7
commit
d256e33683
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
> medium-to-markdown@0.0.2 convert C:\dev\misc\medium-to-markdown
|
> medium-to-markdown@0.0.3 convert C:\dev\misc\medium-to-markdown
|
||||||
> node index.js "https://medium.com/@almenon214/keeping-yourself-motivated-as-a-coder-a16a6fcf49c7"
|
> node index.js "https://medium.com/@almenon214/keeping-yourself-motivated-as-a-coder-a16a6fcf49c7"
|
||||||
|
|
||||||
Keeping yourself motivated as a coder
|
Keeping yourself motivated as a coder
|
||||||
|
|
@ -15,8 +15,6 @@ Follow
|
||||||
|
|
||||||
Programmers probably have one of the most distracting jobs in existence. Their entire workday is spent in front of a computer — a literally endless source of entertainment and pleasure, a limitless virtual heaven. With literally just a click of a button, you could be in another world. You could be slaying dragons. You could be learning about the [great molasses flood of 1919](https://www.damninteresting.com/the-great-molasses-flood-of-1919/). You could literally be doing _anything._ So why do programmers spend their time programming, a hobby that could only be described as exciting by masochistic workaholics?
|
Programmers probably have one of the most distracting jobs in existence. Their entire workday is spent in front of a computer — a literally endless source of entertainment and pleasure, a limitless virtual heaven. With literally just a click of a button, you could be in another world. You could be slaying dragons. You could be learning about the [great molasses flood of 1919](https://www.damninteresting.com/the-great-molasses-flood-of-1919/). You could literally be doing _anything._ So why do programmers spend their time programming, a hobby that could only be described as exciting by masochistic workaholics?
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
<img class="cp t u gs ak" src="https://miro.medium.com/max/2048/1\*S15R5ty8G-kRGo-ghk2EGA.jpeg" width="1024" height="815" role="presentation"/>
|
<img class="cp t u gs ak" src="https://miro.medium.com/max/2048/1\*S15R5ty8G-kRGo-ghk2EGA.jpeg" width="1024" height="815" role="presentation"/>
|
||||||
|
|
||||||
Pictured: sticky, sweet, syrupy disaster
|
Pictured: sticky, sweet, syrupy disaster
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,22 @@ turndownService.addRule('mediumInlineLink', {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Medium has these weird hidden images that are in the html and get rendered
|
||||||
|
// by turndown. We filter these out.
|
||||||
|
turndownService.addRule('noHiddenImages', {
|
||||||
|
filter: function (node, options) {
|
||||||
|
return (
|
||||||
|
node.nodeName === 'IMG' &&
|
||||||
|
node.getAttribute('src') &&
|
||||||
|
node.getAttribute('src').endsWith('?q=20')
|
||||||
|
)
|
||||||
|
},
|
||||||
|
|
||||||
|
replacement: function () {
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
function convertFromUrl(url) {
|
function convertFromUrl(url) {
|
||||||
return new Promise(function(resolve, reject) {
|
return new Promise(function(resolve, reject) {
|
||||||
request({
|
request({
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue