Skip to content

Using doctoc in projects cleaned by prettier

Roy Revelt edited this page Mar 31, 2018 · 2 revisions

prettier will process readme files along with any other markdown documents. You can disable prettier processing the markdown files using .prettierignore by adding the following to it:

*.md

However, it's handy to let prettier process the markdown files because it performs other useful formatting. For example, prettier make table columns to span equal character lengths, what improves readability.

The best solution is to wrap the doctoc placeholders with prettier ignore tags:


## Table of Contents

<!-- prettier-ignore-start -->

<!-- START doctoc -->
<!-- END doctoc -->

<!-- prettier-ignore-end -->

Remember to leave the blank lines around the doctoc comment lines.

Clone this wiki locally