DEV Community

cychu42
cychu42

Posted on

Drawing Inspiration: Docusaurus

What Is It?

I recently looked into Docusaurus, which is a tool to help you build your website. It takes care of most of the work. You mostly just to need to add some .jsor .md files into the right folders to create new webpages you want. If you want, you can also go tweak some setting for your need, like meta tags for SEO(Search Engine Optimization) to show your webpages better in search results.

The Experience With Docusaurus

Using it is relatively simple, given the complicity of setting up a proper website with all the functionalities. By following the tutorial on the website, you can create set up a basic template to host on the web. It has a lot of features, so it can feel overwhelming, but you will be fine if you stick to only reading them when you have the need.

Drawing Inspiration

Part of open source approach is that you can learn from others when allowed. The licence used by Docusaurus is MIT, so one is allowed to copy its features if the license is kept. For my static site generator here, I also uses MIT licence, so it matches.
I decided to take ideas from Docusaurus's ability to parse links because I already have a bit of features in that direction, it's rather crucial, and I already have some idea of what I can do to make it happen.

The Approach

First, I opened an issue to organize the tasks:

  • Support links in Markdown files
  • Accept files in a default static folder to output them into the output folder
  • Allow user to specify the static folder
  • Make sure relative links are always modified to point to the static folder, if user specifies a folder

I then made a prototype to have the basic functionalities complete as proof of concept.
For remaining functionalities, I split them itno different issues(1, 2) that mentions the main issue, to organize the tasks.

The prototype adds two things:

  • Any link syntax (such as (text)[link]) in Markdown files will be converted into a HTML link.
  • If you have a static folder under your input folder directory, all of its content will be copied to the static folder in the output directory.

The ability to specified a stylesheet to use is already an option, so it's not part of the prototype at this stage.

The Experience With Feature Planning

The work is close to what I imagine I would have time for. The planning itself ended up taking a bit more time than I expected, because I was going back and forth between deciding what to do.

Moving Forward

As mentioned, there are two issues(1, 2) to be completed. If anyone is interested helping me with the feature, I would gladly accept the help, even beyond just this feature. After all, it's an open source public project on GitHub. The part of the spirit is in collaboration. They can simply make comments on the issues or open new ones.

Top comments (0)