tyk-docs
tyk-docs copied to clipboard
Add taskfile with md:list and md:fmt targets
This pull requests contains a draft Taskfile.yml. You'll need some software installed:
- https://taskfile.dev/ - A modern Makefile
- https://github.com/bwplotka/mdox - A markdown toolset providing
mdox fmt
The following taskfile targets are available:
task: Available tasks for this project:
* md:fmt: Run mdox fmt on changed .md files on PR
* md:list: List changed .md files on PR
A few issues have been filed upstream against mdox, some have work arounds when running task md:fmt:
- [ ] Ignore front-matter flag/config https://github.com/bwplotka/mdox/issues/154
- [x] Hugo shortcode indentation https://github.com/bwplotka/mdox/issues/155
- [x] Before list spacing not added https://github.com/bwplotka/mdox/issues/156
- [x] Ability to control unordered list style https://github.com/bwplotka/mdox/issues/157
Additionally, md:list also reformats code blocks with a dot prefix (e.g. .js becomes js). This issue is more of a hugo validation issue. For the extremely wrong variants mdox does report issues when scanning.
In order for this to be usable:
- your checkout should have up to date
masterbranch, and the PR branch - run
task md:fmtand it will auto-correct any changes made in the PR
It's absolutely required to keep master in sync with the PR branch on local. If the PR gets rebased, and you don't update your local checkout of the master branch, additional files will be reformatted.
Note: the tool also nicely reformats markdown tables, however more testing is needed to see if some unwanted behaviour occurs for the existing docs. Tested via #4186 ;
To use this for testing on PRs (before any merges are considered), fetch the file inside the root of the repository:
wget https://raw.githubusercontent.com/TykTechnologies/tyk-docs/8fcd9f72cf70ad0b5a771d30457144d2b4b3a15d/Taskfile.yml
This lets you run task md:list to inspect which changes on a PR would be analyzed, and task md:fmt to run the formatters.
@dcs3spp pretty much; you need a wget to fetch the taskfile on local, as this isn't merged to the main branch yet.
Running it in client side hooks would be possible, needs testing, and standardizing on something like lefthook.
Thanks for opening the issues on mdox, will take a look :)
closed in favour of prettier .We will revisti if needed
https://tyktech.atlassian.net/browse/DX-1717