Technical documentation that just works
squidfunk.github.io
squidfunk.github.io
I attempted a Kotlin centric documentation framework a while ago to address this: https://github.com/jillesvangurp/kotlin4example
I mainly use it to generate the documentation for my Elasticsearch Kotlin Client (jillesvangurp/es-kotlin-client). The idea there is that all examples and source samples are correctly compiling Kotlin code that I can get the output of when they run (e.g. a println). Running the tests, actually generates the documentation markdown. Using a dsl and multiline strings, I can mix lambda code blocks, markdown, or markdown inside files. For the lambda blocks, it figures out the source and line numbers using reflection. But it can also grab source samples based on comment markers. For bigger blobs of markdown, it's easier to grab the content from markdown files. For smaller sections of markdown, I can use inline multi line strings or a Kotlin DSL.
The main benefit of this is that my examples update as I change and refactor the code base. Also, since it runs as part of my tests, I know when examples break.
https://oprypin.github.io/mkdocs-code-validator/ https://github.com/crystal-lang/crystal-book/pull/503
1. run the code with some kind of plugin as part of your doc pipeline
2. generate documentation from your code
3. take some kind of hybrid approach
I went for 3., annotate snippet "areas" in the source code of a project (mainly in tests) and extract the snippets to a folder, e.g. into the mkdocs folder. I commit them to the (docs) repo. If the project changes, usually I fix the tests and update the snippets in mkdocs. This way I can be sure that the code in the documentation is actually working and people can copy&paste it. To scratch my own itch, I (surprise, surprise) created a script and even packaged it[1].
live snippets (brett victor hello) or even ability to try permutations of inputs to get a feel
and maybe .. metalevel generated live tests.
But there are a few alternative to Confluence today. Whether it is Notion (not too good for technical documentation, true), Slab, Clubhouse (not the audio app) or even Quip. They mostly fit companies which are under 150 people. Managing documentation with an external tool is hard because technical documentation is better when closest to the source code
1) have horrible navigation 2) lack a good editing experience / CMS, especially when working with a lot of images & videos. Markdown is actually distracting in this case because I have to break my workflow to upload these assets to my CDN. 3) are not designed to meet the needs of product marketing - they can’t have analytics added or they can’t be branded to match the rest of the marketing website.
Maybe I just haven’t found the right tool yet.
1. Internal knowledge bases. 2. Customer help centers.
1. are internal only and usually a tool like Confluence, Notion, or Sharepoint is used. Except from Sharepoint their designs are not very customizable. Because that's not the main use case of these tools
2. are customer facing and is usually easier to customize. There are plenty of tools but they mostly follow the initial "intercom" [1] help center design. A few categories with a bunch of articles and folders inside. They are usually not really great tools. On the navigation part there are still a lot of innovation to be done because we still don't know how to orient people who are novice
In an ideal world, navigation would be chapter-style, similar to Stripe’s docs.
I’m currently using Docusaurus as my public docs site, but it isn’t ideal because 1) it’s cumbersome to manage a lot of uploaded content and 2) it is not particularly easy to manage the navigation.
I’m thinking of rolling my own within my marketing site (that’s built in Gatsby) and using a suitable CMS but I’d certainly like to avoid the time investment.
That told me that Quip seems to be much more intuitive and easier to use for less technical people.
I see all missing a way to create other pages for content marketing (e.g. Academy, Blog etc..).
Some details: Our company is still firmly architected around the 'pets, not cattle' server philosophy, we have tons of teams each owning a small piece of the puzzle, people come and go. Hence,every time something changes, we spend a lot of time on architecture archeology to find back our own application.
There is some work done around the 4+1 view, but its all in word documents, mostly declared holy and locked down so nobody is allowed to update them or even look at them once written, and no 2 people agree about what 4+1 actually means.
https://en.wikipedia.org/wiki/4%2B1_architectural_view_model
Take Material for MkDocs with the "mermaid2" and "plantuml-markdown" plugins, a custom plugin to inline SVG diagrams [1], and "mike" for versioning.
This gets us a Git repo where anyone can draw and contribute diagrams with either Mermaid, PlantUML, or Draw.io diagrams embedded in SVG. Hosted in GitLab Pages for access control.
All three diagram formats support hyperlinks in their outputs, so we're aiming for a clickable, "zoom-able" adaptation of the C4 Model [2].
It's a bit fiddly to get going, but quite nice and easy to work with afterwards, provided individuals can commit time to updating the diagrams.
In principle, GitLab supports PlantUML with extra config, and SVG embeds, but in practice we can't yet commit to updating our self-hosted GitLab, and the SVG embed is aggressively filtered - so Draw.io embeds often show up blank. MkDocs solves the "make it pretty, browseable, and searchable" aspect. Git and "mike" solve the "what was the original design again?" aspect.
I'm tempted to write the approach up, but I broke my blog - perhaps I should rebuild it with Material for MkDocs :)
The Material for MkDocs Insiders program gets you nice extras (mermaid support built-in, stay-on-same-page across "mike" versions, and more) [3]
[1] https://pypi.org/project/mkdocs-plugin-inline-svg/
[3] https://squidfunk.github.io/mkdocs-material/insiders/
(edit: typos)
Pleas blog about this, it is very interesting to me.
Just to be sure: this is what you mean with Mike?
We're not strict about C4 (we actually created an alternative-but-similar flow incidentally) - but C4 to me is a nice diagrammatic principle of "Don't Repeat Yourself" - draw a box, label it, and link to that system's diagram instead.
I could go on for pages / hours :D I'm a bit over-passionate about documentation. Email's in my profile, FWIW.
- one piece of (longish) sample code that uses each stage. It can also be an end-to-end test (not unit) and so forced in sync
- "Design Patterns" - unpopular now, but the whole idea was common idioms so everyone can tell what you're doing.
- very separate modules, with good names; interacting via simple APIs, with good names. Choose these names from outside the implementation, as if by someone who doesn't know it. The names will tell you what it is and what it does.
I accept that these diagrams will always be out-of-date and therefore try to keep text and details to a minimum. I think of it more as a pointer for where to "dig up" a piece of the system or who to ask, to use your metaphor.
What I would love to see is a way to combine markdown pages with source-generated API docs from multiple languages.
In my case, we have Ruby, Java, Scala, Kotlin, Clojure and JS. All of these have their own independent ways of generating API documentation. It would be wonderful to bundle this all up into one static site, and able to reference classes and methods in any language and have it link together.
I think the tablet viewport (aka desktop-not-maximized) could use bit more love, and it's strange to include a dark mode slider and not respect my system dark mode setting, but these are both pretty minor overall. Good job.
> I think the tablet viewport (aka desktop-not-maximized) could use bit more love
IMHO, layouts for tablet viewports are often quite frankensteiny and hard to get really great. Is there anything in particular you feel could be improved?
> it's strange to include a dark mode slider and not respect my system dark mode setting
Material for MkDocs can do that [1], but I've disabled it for the documentation as I like the actual documentation for this tool to have the what I'd call "canonical" styling.
[1]: https://squidfunk.github.io/mkdocs-material/setup/changing-t...
So there's some weird inconsistency in the layout, but the upshot is if I bookmark the page and return to it (or open a link in a new tab), I don't get a right-hand sidebar.
If I did get a sidebar, I'd prefer it to be the left-hand sidebar than the right-hand sidebar, but that's more personal preference.
> Except, if I refresh the page, now the right hand sidebar goes away for some reason.
That is very weird and not intended. I just tried to reproduce the behavior (macOS, Chrome), but to no avail. If you have the time, it'll be great to have an issue with steps to reproduce (and possibly a screen capture), so we can fix it!
The Furo theme is rather new and borrows some things from Material for MkDocs, for example Admonitions. There's also Material for Sphinx [1], which is a port of Material for MkDocs to Sphinx. Note that it doesn't include all features Material for MkDocs offers.
e.g. https://themes.gohugo.io/doks/ or
On the other end of the spectrum you have tools like MkDocs (or mdbook, docsify, docusaurus, etc.) which are more focused on technical docs in markdown format. These tools put much less emphasis on schema, layout, taxonomy and really try to go from a pile of simple markdown files to a rendered site with as little friction as possible. You typically just lay out files in the filesystem, make simple markdown links between files, and the tool takes care of all the details of building a doc site like layout, rendering, linking, table of contents, and even search.
The big tradeoff between them is complexity. There's a _lot_ to learn to fully use something like hugo. You can spend days going through all of its features and building complex asset processing pipelines, themes, taxonomies, workflows, etc. But this is also a bit of a downside if you just want to turn some markdown files into simple technical docs--you have to do a bit of organization, add frontmatter, and learn a few hugo quirks. You'll have a fancy base to really go wild and add tons of content... but for technical docs you might not need all that power and complexity.
MkDocs strikes a really nice balance in this regard--you basically just write markdown files with simple links and it will figure out the rest. The Material theme here is _very_ slick and one of the best out of the box themes you'll find for any technical docs generator (or even SSG in general) period. This combo is so good Spotify use it heavily in their developer portal system Backstage: https://backstage.io/blog/2020/09/08/announcing-tech-docs That's a pretty strong endorsement IMHO.
What I was missing, is a list of quickstart best practise scenarios along with a well designed template for exactly this use case, like:
- A small blog
- A companies homepage
- A photographers website
- A technical documentation with search index
- An image gallery
Since all this IS possible with hugo, you just have to find your way to do it, I think ;)It's great because the speed and ease of use is unrivaled, but nowadays a jamstack site is much, much more than just a pile of markdown turned into HTML. People are building complex SPA, SSR, hybrid, etc. architectures and using fancy webpack-based workflows with all kind of transpilation, code generation, etc. at every level. You have to jam all of that into hugo's workflow and it just adds to the complexity--now you need a full node/JS frontend setup (with webpack/babel/postcss/etc.) and hugo's setup on top of that. Hugo tries to do some of this itself with esbuild but it still is hard to get away from bolting on webpack with hugo and getting the best... and worst... of both worlds.
Along these lines, the case for exporting a static site from NextJS (leaving the door open to all the options) is a lot stronger than trying to bolt on dynamic functionality to Hugo. IMHO it's not even close.
My dream setup would be something with simple file-based routing like MkDocs, all of the rendering formats and power of pandoc, and the ease of deployment and speed of a Hugo-like static binary in Go (just one exe and you're done).
That's exactly the value proposition of Material for MkDocs. Just throw Markdown at it and tweak it with some configuration, if desired.
> MkDocs strikes a really nice balance in this regard--you basically just write markdown files with simple links and it will figure out the rest. The Material theme here is _very_ slick and one of the best out of the box themes you'll find for any technical docs generator (or even SSG in general) period.
Thanks!
pydantic - https://pydantic-docs.helpmanual.io/
FastAPI - https://fastapi.tiangolo.com/
Starlette - https://www.starlette.io/
AutoKeras - https://autokeras.com/
AWS Amplify console can deploy this with SSL and zero config.
Also, the search is my favourite feature.
A) Let's me and other users add annotations to a document.
B) Allows me to view all the annotations added to a doc.
C) Automatically, or semi-automatically merges annotations from the "version 1.0" doc into the newly released document for "version 1.1".
PDF covers (A) and (B) but I haven't been able to find a tool that does (C).
- https://fastapi.tiangolo.com/
- https://crystal-lang.org/reference/
- https://mozillafoundation.github.io/engineering-handbook/
- https://microsoft.github.io/code-with-engineering-playbook/
[1]: https://github.com/squidfunk/mkdocs-material#trusted-by-
EDIT: You're right, on mobile it only switches to "Type to start searching" after clicking in the search field. Thanks! I'll file a bug report so we can fix it.