tfwright

tfwright

Docout: flexible documentation generator

Recently I could no longer put off the task of creating some internal documentation so that FE developers would be able to more easily integrate a React app with our API. Meanwhile I have been in the process of porting over some documentation of a public facing API that used OpenApi spec (generated with rswag) to Phoenix.

I hadn’t really enjoyed the experience of learning a custom DSL and fighting weird syntax differences and missing features, and OpenApi seemed like overkill for a small internal API anyway, so I decided I wanted a different approach. After a quick survey of existing option I decided to create a tool that would allow me to:

  1. Write specs in a format I found convenient and easy to parse/update when working in code
  2. Generate different docs for different audiences
  3. Update generated doc files automatically

The result is docout: GitHub - tfwright/docout: Generate documentation files from your existing Elixir app docs at compile time.

As you will see if you go through the code, it is very simple, basically just a glorified compiler task that parses module docs, formats them, and then prints them to a file. I am using it to configure which modules should generate which docs (external vs internal api) and use the excellent OpenApiSpex side by side with my own custom doc format which uses a version of Slate, which I like because it uses markdown files for easy viewing when in the code as well as a web interface.

Hopefully others may find this useful, please let me know your thoughts in any case!

Cheers

Most Liked

tfwright

tfwright

The latest update contains some breaking changes to be aware of before updating. The parsing logic and output path overrides have been moved from app config to use keyword opts to be more in line with official Elixir library guidelines.

For an example of how to migrate output_path options see this commit: Update docout · tfwright/live_admin@4b56d50 · GitHub

Migrating the parsing logic is similar. Just remove the relevant config from config.ex and pass the parse_function to the use options as demonstrated in the advanced usage docs.

Note that even if you are not using either of these options you should replace @behaviour Docout.Formatter with use Docout to avoid breakage.

For those of you who are unfamiliar with the library, I revamped the docs as well if you want to a rundown of what it’s about. Feel free to raise any questions or make suggestions here. I am hoping to get around to packaging a hex release soon.

Cheers!

Where Next?

Popular in Libraries Top

marcuslankenau
I feel kind of stuck with the absence of a proper xml library for Elixir. Currently I use SweetXML which was ok for me more or less to pa...
New
woylie
I released Doggo, a collection of unstyled Phoenix components. Features Unstyled Phoenix components. Storybook that can be added to...
New
kelvinst
Hey everyone! Well, we made this lib a while ago and now we decided to finally go out and public with it! It’s a tool for creating and m...
New
danschultzer
In short Plug n’ play OAuth 2.0 provider library. Just set up a resource owner schema with Ecto (your user schema), install the dependen...
New
asiniy
Hey there! I wrote a download elixir package which does exactly what its name about - an easy way to download files. I saw solutions ...
New
woylie
Flop is an Elixir library that applies filtering, ordering and pagination parameters to your Ecto queries. offset-based pagination with...
New
Qqwy
While not as prevalent as in imperative languages, arrays (collections with efficient random element access) are still very useful in Eli...
New
KallDrexx
For a good number of months I've been working on creating a very basic RTMP live video streaming server. Now that I have a very, very ba...
New
wojtekmach
Hey everyone! Req is an HTTP client for Elixir that I’ve been working on for quite some time. There is already a lot of HTTP clients out...
New
maltoe
Hello! Came here to announce ChromicPDF, a pet project PDF generator I’ve been working on for the past few months. Why another PDF gener...
New

Other popular topics Top

yurko
Here are few pieces of (common) Linux knowledge that we use for reasonably small one server apps. We use Ubuntu but this should work for ...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
johnnyicon
Hi all, I've just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I'm trying to use Postg...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New

Sub Categories:

We're in Beta

About us Mission Statement