DEV Community

Cover image for Good news is here! ๐ŸŽ‰๐ŸŽ‰๐ŸŽ‰use artipub to automatically publish the article to more platforms
FreeCoderX
FreeCoderX

Posted on • Updated on

Good news is here! ๐ŸŽ‰๐ŸŽ‰๐ŸŽ‰use artipub to automatically publish the article to more platforms

ArtiPub (article release assistant) is a tool library aimed at simplifying content creators to publish the article process.It provides a simple API that allows you to easily publish the article to any platforms, such as blogs, social media, etc., without manual operation of each platform. artipub

โ“ Why do you need artipub?

  1. Local pictures cited in Markdown need to manually compress the picture, then upload to the bed, and finally replace the picture link
  2. After Markdown finished writing, I want to publish it to other platforms to avoid manual Copy
  3. After Markdown finished writing the article, I need to modify some of the contents of Markdown and let it regenerate the content of Markdown
  4. ...

Note: ArtiPub will help you solve these problems automatically, and will expand more in the future

โœจ Features

  • ๐ŸŒ Multi-platform release: Support that the Markdown article is published to multiple mainstream content platforms, including but not limited to Notion, Medium, Dev.to, etc.
  • โœจ Simple and easy to use: Provide a simple API, and only need a few lines of code to implement the article release.
  • ๐Ÿ”Œ Support middleware and plugin: Through plug -in and middle parts, let users make more fine -grained control processing and release processes.
  • ๐Ÿ“– Complete open source: Encourage community contributions and continue to increase new platform support and functions.

๐Ÿ“Œ TODO

  • [x] DevToPublisherPlugin
  • [x] Document Site

๐Ÿ”ง Built-in

Treatment middleware

Name Support Description
piccompress โˆš Automatic compression of the picture
Picupload โˆš Picture Upload

Publish plug -in

Name Support Description
NOTIONPUBLISHERPLUGIN โˆš Published to NOTION
DEVTOPUBLISHERPLUGIN โˆš Published to DEV.TO

๐ŸŒŸBirth background

Phase 1: Abandon Evernote and switch to Notion

At first, I used Evernote to record notes. As time went by, I came into contact with more and more things, and naturally I recorded more and more notes. So I wanted to classify my notes more finely, but Evernote only has three levels of classification. I learned how to organize notes online, read a series of articles, and finally found that this method of classification with a maximum of three levels of directories made me very uncomfortable.
Another point is to fix "Evernote" to the start screen. Every time they update the version, my "Evernote" icon is lost from the start screen. I have to add it manually every time I update, which also makes me very unhappy. I have given them feedback, but their problem has always existed. I really can't stand it, so I searched for various note-taking software on the Internet, and finally found Notion
It meets my needs very well. You can create directory levels at will, article management is very convenient, and the article layout method can be adjusted very flexibly. This software is very suitable for me, so I migrated all the notes in Evernote to Notion.

Phase 2: Break away from the notion island and share knowledge

As time goes by, I have become a heavy user of Notion, which means that every note or article I write is written in Notion first. I have written a lot of notes, and I hope to share my knowledge. Then I thought of putting the article on my blog, Nuggets, Medium, dev.to and other platforms, but this process is very cumbersome, which directly wipes out your interest in writing articles and sharing knowledge. If you write your article in Chinese, it is okay to put it on your own blog or domestic platform, but if you want to put the article on a foreign platform, this process is very painful. First, you have to translate the article, and then re-upload every picture in it. The most frustrating thing is that Medium does not support copying markdown to the editor of its platform (it uses a very primitive editor, which may be designed by the platform to ensure the beauty and quality of the article). After copying the markdown content to the Medium editor, the article format is all messed up. This process makes me very painful. If you have had such an experience, you can definitely feel the pain in the middle. You may ask: "Since Medium is so difficult to use, why do you still put articles on Medium? The reason is: it is very mainstream and you can earn income by writing articles, unlike various domestic platforms..."

Phase 3: How to distribute articles on notion?

I have written so many notes, how can I share the knowledge I have mastered? So I searched for notion to markdown on the Internet, and immediately found notion-to-md. At this time, I can happily convert many of the article notes I wrote on notion into markdown, and then publish them to the blog platform. After doing it, I found that the article pictures seemed to be temporary picture addresses, and the pictures could not be found after a while. This made me a little confused. If I manually download the articles on notion, I will find that the articles and pictures are together. Then, can I write a tool to format the zip file downloaded from notion into the format of my blog article with one click? So I added some column processing functions, such as automatic decompression of zip, automatic compression of pictures, automatic upload of pictures, automatic replacement of picture addresses with cdn, automatic submission and publication of articles, etc. After this operation, can I make a library to write articles in markdown and distribute them to any platform with one click? You may ask: Why not use notion to write articles and then distribute them to any platform through tools? Of course, this is also possible, but it adds the steps of writing articles in Notion, downloading articles, and subsequent processing. So why not use markdown to write articles directly, and then use tools to automatically process articles and resources. This is more flexible, so there is artipub, an article publishing assistant.

๐Ÿ”Artipub prototype

ArticleProcessor

  • Input: markdown draft, image resources
  • Processing process: parsing markdown, modifying markdown content, uploading images, replacing image addresses, etc. (This process: to facilitate upper-level users to flexibly modify markdown content, so markdown AST is immediately thought of, so that markdown content can be easily modified)
  • Output: convert the processed ast into markdown and store it in the specified place

PublisherManager

  • Input: markdown article content
  • Processing: Some platforms need to remove certain parts of the article or extract certain parts of the article (this process: various platform plug-ins need to be added to facilitate publishing articles to various platforms)
  • Output: Output the publishing results to the console

Additional note: Before the official opening, you may have all kinds of entanglements and have a fantasy: to make the best and most awesome tool, constantly high, and constantly diverge your thoughts... Special note: If this state continues, you will not be able to do anything, so you must converge your thoughts in time, put your initial ideas into practice, and then continue to iterate, so that you can make a good tool. Today I watched Anthony's open source road: Yak Shaving "่–…็‰›ๆฏ›", which means that I have a deep understanding of this state, so I wrote this paragraph to warn everyone to converge their thoughts and attention in time and get started. (I used to be such a person)

๐Ÿ’ชRoll up your sleeves and get to work

Phase 1: Implementing the first basic version

git commit record

Note: The first version took a total of 10 days, and I wrote more on weekends, and only a little on weekdays.

The second stage: Use it in your own blog project. Otherwise, how can you verify whether the library you made is usable and easy to use?

At first, I sent the package directly to npm, and then used it in the blog project. I found that the package had various problems, which led me to send a lot of broken temporary packages, as shown below:
alt text

I was thinking that this was not a solution. The first problem was that my version grew too fast. The second problem was that I released so many broken packages, which was irresponsible to the users of artifactipub and would have a bad impact on the promotion of artifactipub in the future.

Solution to the first problem: I searched a lot on the Internet and found many libraries that updated versions and generated changelogs, but I still couldn't choose which library to use. I accidentally opened GitHub on the subway to look at the exploration page and saw the version release. At this time, I thought about which library released the changelog that looked good, and finally found changelogen was simple and easy to use, so I chose this library.
alt text

The solution to the second problem is to add a playground to the artifactipub project to avoid the need to publish packages frequently. In this way, various functions of artifactipub can be tested in the playground, and then the functions of artifactipub can be integrated into the blog project to avoid publishing many bad packages.

Phase 3: Integrate Artipub into the blog project

When integrating artifactipub into the blog project, I immediately discovered a problem. The blog code is still written in the commonjs specification. Although artifactipub supports both commonjs and esm specifications, the reference library still reports that the esm module cannot be introduced. I forgot the specific error. I was thinking that esm is already the trend of the future, so I might as well change the blog project to the esm specification to avoid messy errors. However, after I changed to the esm specification, I still found that there were still various problems using artifactipub. This tells me: no matter your library, there is no problem with local testing, and there is no problem with adding playground testing. If you donโ€™t apply the library to a real project, you will never know what problems will arise, so you must apply the library to a real project in a timely manner so that you can find problems and then solve them.

๐Ÿ“ŠCurrent situation

  • [โˆš] artipub has been integrated into my blog project and verified to be usable normally.
  • [โˆš] artipub has its own documentation website for easy viewing and use. aritpub portal
  • [ ] Improve api documentation
  • [ ] Add test cases
  • [ ] Support publishing articles to more platforms

If you are interested in this project, please help me click a star๐ŸŒŸ. You are also welcome to join us so that we can improve this project together and help more people. ๐Ÿ˜Š

๐Ÿ“Summarize

  • From an idea to its actual implementation, there are many ups and downs in the middle. Ideas, inspirations, and fantasies will make your mind diverge constantly. Finally, you must converge your thoughts and attention in time, implement your ideas, and then continue to iterate, so that you can make your tool.
  • Copilot is a very easy-to-use AI assistant. I personally feel that it is much better than other assistants. After all, it has the best model training data github. If you encounter various problems in the process, it can basically help you solve them, but it also has its limitations. For example: if you want to make a function, the idea is not very clear. You can keep communicating with it, so that your ideas can be formed into a draft and then implemented. This process is still very helpful. At first, I tried it for a month with $9.9, and later found that it was very easy to use and the money was worth it, so I immediately switched to an annual subscription. I recommend everyone to try GitHub Copilot

๐Ÿ“šๅ‚่€ƒ่ต„ๆ–™

Top comments (0)