> I was wondering how we could let every contributor follow the same mk
rule.

As long as contributors install Prettier with the same version, markdown
files can be auto-formatted in the same way without extra working via the
`prettier --write **/*.md` command, and this can also be set as a part of
pre-commit hook. To check whether markdown files satisfy formatting
requirements, we can use `prettier --check **/*.md` where exit code 0 means
it does follow the styles.

> Is there any way to integrate the format check into our CI pipeline?

Yes, it is possible. I have tested using GitHub Actions, and I think Azure
pipelines also support this feature.

```yml
jobs:
  Check-MD-Format-Actions:
    runs-on: ubuntu-latest
    steps:
      - name: Check out repo code
        uses: actions/checkout@v3
      - name: Prettify code
        uses: creyD/prettier_action@v4.2
        with:
          prettier_options: --check **/*.md
```

> Another thing is that some docs are written with Hugo syntax. Would they
work together with no conflict?

Well, it will never cause any conflict. Since Hugo syntax is a superset of
regular markdown syntax, and Prettier is compatible with CommonMark (
https://commonmark.org/) and GitHub Flavored Markdown.

On 2023/02/22 10:22:46 Jing Ge wrote:
> Hi Zhongpu,
>
> Thanks for starting this discussion. I was wondering how we could let
every
> contributor follow the same mk rule. I am not familiar with Prettier.
Would
> you like to help me understand some basic questions? Thanks.
>
> Is there any way to integrate the format check into our CI pipeline?
> Otherwise, it will be hard to control it. Another thing is that some docs
> are written with Hugo syntax [1]. Would they work together with no
conflict?
>
>
> Best regards,
> Jing
>
> [1] https://gohugo.io/
>
> On Wed, Feb 22, 2023 at 9:50 AM Zhongpu Chen <ch...@gmail.com> wrote:
>
> > As I mentioned in FLINK-31177 (
> > https://issues.apache.org/jira/browse/FLINK-31177):
> >
> > Currently, markdown files in *docs* are maintained and updated by many
> > contributors, and different people have varying code style taste. By the
> > way, as the syntax of markdown is not really strict, the styles tend to
be
> > inconsistent.
> >
> > To name a few,
> >
> >    - Some prefer `*` to make a list item, while others may prefer `-`.
> >    - It is common to  leave many unnecessary blank lines and spaces.
> >    - To make a divider, the number of `-` can be varying.
> >
> > To this end, I think it would be nicer to encourage or demand
contributors
> > to format their markdown files before making a pull request.
Personally, I
> > think Prettier (https://prettier.io/) is a good candidate.
> > What do you think?
> >
> > --
> > Zhongpu Chen
> >
>

Reply via email to