Skip to content

Commit

Permalink
markdown: implement a TODO container
Browse files Browse the repository at this point in the history
  • Loading branch information
slusarz authored and cmouse committed Jul 1, 2024
1 parent 674d1e8 commit 5b61c61
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 11 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -274,3 +274,18 @@ Create a update tag based on a tag_name.
The tag_name must be defined in `data/updates.js`.

Example: `[[changed,tag_name]]`

### Other Markdown Extensions

#### TODO Container

***Syntax:***

```
::: todo
TODO text contents
:::
```

Outputs a formatted TODO container, using the (optional) TODO text contents
as the body.
10 changes: 4 additions & 6 deletions docs/core/admin/limits.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@ title: Limits
Dovecot contains various built-in resource limits designed to prevent
denial of service situations. This page lists those limits.

::: todo
This list is currently incomplete.
:::

## Message Headers

There is a `10 MB` limit for a single message header block, and a `50 MB`
limit for all header blocks in a message.

## TODO

::: danger TODO
List other limits here
:::
3 changes: 2 additions & 1 deletion docs/core/config/imap.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ mail_attribute_dict = proxy::metadata

### SPECIAL-USE

TODO
::: todo
:::

### PREVIEW

Expand Down
4 changes: 2 additions & 2 deletions docs/developers/debugging.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ dest=core.tar.gz

## Debugging Core Dumps in Other Systems

::: warning TODO
Move to Pro
::: todo
Move to Dovecot Pro documentation.
:::

If you have a tar.gz generated from dovecot-sysreport, you can debug it
Expand Down
10 changes: 10 additions & 0 deletions lib/markdown.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
import containerPlugin from 'markdown-it-container'
import deflistPlugin from 'markdown-it-deflist'
import { createMarkdownRenderer } from 'vitepress'
import { loadData, loadDovecotLinks, resolveURL } from './utility.js'

export async function dovecotMdExtend(md) {
md.use(containerPlugin, 'todo', {
render: function(tokens, idx) {
if (tokens[idx].nesting === 1) {
return '<div class="caution custom-block">\n<p class="custom-block-title">⚠️ TODO</p>'
} else {
return '</div>\n'
}
}
})
md.use(deflistPlugin)
md.use(dovecot_markdown, {
dovecotlinks: await loadDovecotLinks(),
Expand Down
9 changes: 8 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"fast-glob": "^3.3.2",
"git-commit-info": "^2.0.2",
"import": "^0.0.6",
"markdown-it-container": "^4.0.0",
"markdown-it-deflist": "^3.0.0",
"markdown-it-mathjax3": "^4.3.2",
"pagefind": "^1.1.0",
Expand All @@ -17,7 +18,7 @@
"unified": "^11.0.5",
"unist-util-map": "^4.0.0",
"vitepress": "^1.2.3",
"vitepress-plugin-pagefind": "^0.4.1",
"vitepress-plugin-pagefind": "^0.4.3",
"vitepress-sidebar": "^1.23.2"
},
"scripts": {
Expand Down

0 comments on commit 5b61c61

Please sign in to comment.