diff --git a/exampleOutput.md b/exampleOutput.md index 27b10b4..c68989c 100644 --- a/exampleOutput.md +++ b/exampleOutput.md @@ -5,13 +5,13 @@ Keeping yourself motivated as a coder ===================================== -[![Almenon](https://miro.medium.com/fit/c/96/96/1*4FAOBq9qVna6uHkxaolTtA.png)](/@almenon214?source=post_page-----a16a6fcf49c7----------------------) +[![Almenon](https://miro.medium.com/fit/c/96/96/1*4FAOBq9qVna6uHkxaolTtA.png)](https://medium.com/@almenon214?source=post_page-----a16a6fcf49c7----------------------) -[Almenon](/@almenon214?source=post_page-----a16a6fcf49c7----------------------) +[Almenon](https://medium.com/@almenon214?source=post_page-----a16a6fcf49c7----------------------) Follow -[Sep 23, 2018](/@almenon214/keeping-yourself-motivated-as-a-coder-a16a6fcf49c7?source=post_page-----a16a6fcf49c7----------------------) · 4 min read +[Sep 23, 2018](https://medium.com/@almenon214/keeping-yourself-motivated-as-a-coder-a16a6fcf49c7?source=post_page-----a16a6fcf49c7----------------------) · 4 min read 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? @@ -33,7 +33,7 @@ But if you’re reading this article, maybe you _don’t_ have anything to motiv 2. **Releases.** Your project is a piece of crap. It barely functions, the architecture is horrible, and [you don’t even really know what you’re doing](https://en.wikipedia.org/wiki/Impostor_syndrome). The last thing you want to do is to expose your baby duckling to the public. But at a certain point you have to cut your losses — you can’t just keep on working on something forever, because then you’re going to have burnout. And you may be pleasantly surprised. Maybe people will like it. Worst case scenario, people will hate it, but in the process of shitting all over it they inadvertently give you helpful advice to fix it. In fact, in my experience the detractors are more helpful than the fans, because they will give you actual advice, not just “oh that looks cool”. 3. **Maximize Fun**. Look for more pleasurable and fulfilling fun, rather than lazy and cheap entertainment. For example, it’s far too easy to _control-n_ to open a new tab and type in the letter r to get the autocomplete for reddit. That’s just 3 keys and a enter. Reddit is fun, I love it, but its filled with low effort reposts. Taking the time to watch a show or even a movie might be a better idea — you have a clear chance to stop (at the end) rather than scrolling through reddit’s infinite amount of content. Important disclaimer: _never_ click on netflix’s next episode button. That’s a feature designed by the devil to get you to binge-watch shows and hate yourself afterwards. If you actually have time to watch the next episode then you can wait for the credits to go by. Or more likely, realize what you are doing and go do something productive. 4. **Take walks.** Rest your eyes. Think about how to approach the problem. If you’re me, try reading while walking. It’s not that dangerous — you’ve only bumped into a pole once or twice. -5. **Get the support of others**. Join a slack/discord community. Make a program that other people use. Ask for advice from your friends. Go to programming meetups. Go to [programming conventions](/@almenon214/pycon-2018-6b1c45889e3b) — it’s a great excuse for a vacation, and it’s a lot less dry than it sounds. Go past your normal boundaries — you might be surprised as to what you are capable of. -6. **Add** [**telemetry**](/@almenon214/adding-telemetry-to-your-vscode-extension-f3d52d2e573c) **or** [**alerting**](/@almenon214/setting-up-email-alerts-for-your-vscode-extension-using-azure-d755651b2e0d) **to your program**. It might not be practical for a small application, but it is _extremely_ useful as a motivating tool. Every day I get emails from around the world. People use [AREPL](https://github.com/Almenon/AREPL-vscode) in [New York, Canada, Brazil, Chile. Europe, Japan, Israel, and Pakistan](/@almenon214/arepl-stats-for-june-5e0c87636c3). Every day it’s a different country. It’s significant to know that people are using what I make and relying on me to continue developing it. In a similar vein, I also get emails whenever my reddit bot posts. I can see if people upvote it or if there are problems with the bot I need to fix. +5. **Get the support of others**. Join a slack/discord community. Make a program that other people use. Ask for advice from your friends. Go to programming meetups. Go to [programming conventions](https://medium.com/@almenon214/pycon-2018-6b1c45889e3b) — it’s a great excuse for a vacation, and it’s a lot less dry than it sounds. Go past your normal boundaries — you might be surprised as to what you are capable of. +6. **Add** [**telemetry**](https://medium.com/@almenon214/adding-telemetry-to-your-vscode-extension-f3d52d2e573c) **or** [**alerting**](https://medium.com/@almenon214/setting-up-email-alerts-for-your-vscode-extension-using-azure-d755651b2e0d) **to your program**. It might not be practical for a small application, but it is _extremely_ useful as a motivating tool. Every day I get emails from around the world. People use [AREPL](https://github.com/Almenon/AREPL-vscode) in [New York, Canada, Brazil, Chile. Europe, Japan, Israel, and Pakistan](https://medium.com/@almenon214/arepl-stats-for-june-5e0c87636c3). Every day it’s a different country. It’s significant to know that people are using what I make and relying on me to continue developing it. In a similar vein, I also get emails whenever my reddit bot posts. I can see if people upvote it or if there are problems with the bot I need to fix. Hopefully these tips are helpful to you. If they are, I’d love to hear it. Or maybe you have a tip of your own — either way, leave a comment below! diff --git a/lib/convertFromUrl.js b/lib/convertFromUrl.js index ba62afa..654a216 100644 --- a/lib/convertFromUrl.js +++ b/lib/convertFromUrl.js @@ -8,6 +8,31 @@ const gfm = require('turndown-plugin-gfm').gfm const turndownService = new TurndownService() turndownService.use(gfm) +// following block adapted from https://github.com/domchristie/turndown/blob/61c2748c99fc53699896c1449f953ea492311c5b/src/commonmark-rules.js#L131 +turndownService.addRule('mediumInlineLink', { + filter: function (node, options) { + return ( + options.linkStyle === 'inlined' && + node.nodeName === 'A' && + node.getAttribute('href') + ) + }, + + replacement: function (content, node) { + var href = node.getAttribute('href') + + // following code added in to handle medium relative urls + // otherwise the link to article "foo" in the new website would go to + // https://newwebsite.com/@username/foo-a16a6fcf49c7 which doesn't exist + if(href.startsWith('/')){ + href = "https://medium.com" + href + } + + var title = node.title ? ' "' + node.title + '"' : '' + return '[' + content + '](' + href + title + ')' + } +}) + function convertFromUrl(url) { return new Promise(function(resolve, reject) { request({