Dok just reached a new major version, version 2! It's full of new features that make creating a documentation site on Statamic really easy. You can read more about all of these changes in the documentation.
Dok now uses Torchlight Engine, a free and open-source (MIT) code annotating package that uses Phiki under the hood for blazing fast code highlighting.
Previously, when using Shiki PHP code highlighting, it would take a considerable amount of time to parse and render the highlighted code. Now, render speeds are increased by over 300%, and usage of cache tags is no longer a strong recommendation.
Since it's just a PHP package, you no longer need the node dependencies!
Another benefit of using Torchlight Engine is language labels. These will appear automatically if you have Torchlight Engine enabled and will show the current language being used in the code block.
We built a brand new hints extension for v2, giving the ability to show callouts for important sections of your document. The syntax is very familiar to those you may have used before:
:::important
This is an important hint
:::
We've added a much-needed feature, a copy code button. Click it, and it will copy the current code block contents for you to paste elsewhere.
In v1, we used the nav:breadcrumbs tag. This tag worked its way back from the URL segments.
Since you can have text-only items in navigations, you could end up in a situation where your breadcrumbs don't match up with what's in your sidebar categories. (We only use them to show where you are on the page; they aren't links and are presentation only.)
This is how ours works:
Look for the current URL of /italian/articles/dance in your projects navigation.
If it finds an entry with that URL, it then moves up the tree to that item's parent, regardless of whether it's an entry or a text-only item.
Let's say you have a url of myplugin/1.x/installation and a navigation with a text-only item:
Getting Started
# Result:
Documentation > Updating
That's not exactly helpful, since the first breadcrumb is the home page of the docs collection (the page our collection is mounted to).
# Result:
Getting Started > Updating
Now, the breadcrumbs are using the sidebar, so both are completely cohesive and unified.
{{ release:breadcrumbs }}
<span>
{{ title }}
</span>
{{ /release:breadcrumbs }}
More sidebar template options. You can now choose between 2 different templates that come with different styles and functionality.
Enhanced visual styles.
Numerous other fixes and accessibility improvements.
Here's what we've made so far. The list is always growing!