decaporg / decaporg/decap-cms

Provide custom remark-stringify options

Open
#4,601 5 comments 3 reactions 0 assignees View on GitHub
area: configuration area: extensions/widgets/markdown area: extensions/widgets/richtext type: feature
Dominant language
JavaScript
Stars
19.4k
Forks
3.1k
Avg merge
1d 14h
Merged PRs (30d)
9

Description

**Is your feature request related to a problem? Please describe.**
The markdown output works perfectly. However, we are using prettier and eslint to ensure consistent formatting of the whole project, including Markdown. The formatting rules differ between prettier and netlify-cms, e.g. prettier prefers `-` for unordered lists while the [default setting in netlify-cms](https://github.com/netlify/netlify-cms/blob/master/packages/netlify-cms-widget-markdown/src/serializers/index.js#L112) is `*`.

**Describe the solution you'd like**
The best solution would probably be to offer an interface that I can use in my custom `cms.js` to pass [arbitrary options](https://github.com/syntax-tree/mdast-util-to-markdown#formatting-options) to remark-stringify.

**Describe alternatives you've considered**
I could probably change my prettierrc to use the netlify-cms default rules, but users might have a different preference for various reasons.

**Additional context**
- supported options: https://github.com/syntax-tree/mdast-util-to-markdown#formatting-options
- netlify-cms default options are defined in https://github.com/netlify/netlify-cms/blob/master/packages/netlify-cms-widget-markdown/src/serializers/index.js#L112
- prettier Markdown formatting rules: https://github.com/prettier/prettier/pull/2943

Contributor guide

Open the contributing guide

Research direction

Start by reading packages/netlify-cms-widget-markdown/src/serializers/index.js and compare its default remark-stringify settings with the linked mdast-util-to-markdown options. Trace how a custom cms.js configuration reaches the Markdown serializer; done means supported arbitrary formatting options can be supplied there and affect generated Markdown without changing existing defaults.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
content, frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.