Writing a dev.to blog post with VSCode

Tim Deschryver on June 12, 2019

Today, I present you πŸ“ New Blog Post a simple way to create and publish dev.to blog posts from within Visual Studio Code. Installation ... [Read Full]
markdown guide
 

Installed! Please everyone let us know if there are other APIs we can provide to improve this experience so folks feel like they have full confidence in this process. Really fun stuff!!!

 

Thanks Ben!
If I encounter something I will definitely create an issue on GitHub πŸ˜ƒ

Maybe one thing that took my a couple of minutes, would be to add some kind of validation responses in the response. For example: if the title has not been filled in, the response is 500: Internal Server Error.

curl -X POST -H "Content-Type: application/json" \
-H "api-key: ACCESS_TOKEN" \
-d '{"article": {"body_markdown": "a body"}}' \
https://dev.to/api/articles

But as I'm writing this, I also noticed that the api docs mentioned these validation messages - so it is probably me who's doing something wrong πŸ˜…

If you want I can create an issue for this and we can take it from there.

 

Could still benefit from a proper status code, in this case it sounds like you were missing information, so maybe a 400 is appropriate?

422 would probably be more appropriate, but yes, a 4xx status is the way to go.

Yes, I think having a 4xx would make these "errors" more understandable for us.

 

Nice tool! Thanks to share it :)

I visited your website, could you explain a bit your flow you used to update your website based on Now to create a new post on your site? I'm curious about it!

thanks

 

Thank Cyril!

I'm using Sapper as a static site generator (you could use more popular ones like Gatbsy, Gridsome, Next, ...). When I push changes to GitHub, Now has a trigger to build the website and deploy it to their servers.

In your repo, you should have a now.json for config, and a now-build script.

You can find out more info on Now for GitHub, if you have a question, feel free to DM me.

 
 

Really cool - between this and VS Code's Spotify extension I may never have to leave my editor now

 

Spotify extension? Holy Mowly! That goes to the 'search it after exams' list πŸ˜πŸ‘

 
 

Awesome VSCode extension! I made a CLI @hagnerd/devto inspired by this extension for any non-VSCode users. I'm sure it's a little rough around the edges still, but figured anyone who stumbled on this post might be interested. :)

 

Using this now! I had a question about code snippets but I was able to figure it out using markdown. Thanks for sharing!

 

Yes, the post you write is completely in markdown. I'm sorry I did not mention it.

 

I'm getting an "internal server error" when I try to publish. Any ideas how I could troubleshoot this? I'm not extremely fluent with VS Code extensions yet.

 

This version of the extension, simply calls the dev.to API and shows the response of the API. I will work on this, so these errors will be more readable in one of the upcoming versions.

I think you're getting this error because one of the front matter properties are not filled in - for more info see the api docs and search for front matter.
For now, feel free to DM me your blog post (or a trimmed down version) and I can take a look.

That makes sense! I didn't have the cover image and canonical url filled out. I'll let you know how it goes with my next post, planning on making another by early next week.

For what its worth, I just tried it with an empty image and canonical and it seems to be working on my end. The only required field (that I know of) is the title

 

Nice job, just hoping that token is not your real one!

 

It WAS my real one.
The thing was that I couldn't revoke my access token, so I had to delay the publication of this post. Good thing the dev.to team solved this issue in a day 😁

 
 
 
 

Sounds awesome! I'll give it a try tomorrow (left my laptop at the office)

 

Cool! Feedback is always appreciated πŸ˜‰

 

Wow! This is an awesome extension and a great way to learn. Good job

 

Thanks Jim!
It was indeed a fun experience where I a couple of things.

 
code of conduct - report abuse