Problem/Motivation
We have no official stance towards or policy/coding standards for Markdown in projects or on *.d.o sites (see related issues).
Benefits
Having this resolved would allow consensus and policy to be built to cascade down to revise, standardize the onslaught of contrib README.MD in-contrib documentation.
In addition GitLab Pages support has been added to the gitlab_templates project using mkdocs which is Markdown based increasing the number of Markdown files possibly present in project repositories.
Three supporters required
- /u/baluertl (Feb 18, 2025)
- https://www.drupal.org/u/{userid} (date that user added support)
- https://www.drupal.org/u/{userid} (date that user added support)
Proposed changes
1. https://www.drupal.org/docs/develop/coding-standards/markdown-coding-sta...
Current text
This topic is currently being discussed:
#2952616: [policy, no patch] Markdown coding standards (adopt CommonMark spec)
#2191525: [PP-1][policy, no patch] Extend Markdown coding standards to support API module (DOXYGEN)
Proposed text
Markdown must adhere to the most recent release of the CommonMark specification.
Remaining tasks
Create this issue in the Coding Standards queue, using the defined template- Add supporters
- Create a Change Record
- Review by the Coding Standards Committee
- Coding Standards Committee takes action as required
- Tagged with 'Needs documentation edits' if Core is not affected
- Discussed by the Core Committer Committee, if it impacts Drupal Core
- Documentation updates
- Edit all pages
- Publish change record
- Remove 'Needs documentation edits' tag
- If applicable, create follow-up issues for PHPCS rules/sniffs changes
For a full explanation of these steps see the Coding Standards project page
Notes
This has previously been discussed and supported by the TWG #2191525-54: [PP-1][policy, no patch] Extend Markdown coding standards to support API module (DOXYGEN):
The TWG discussed this on today's call and we would support adopting the commonmark markdown spec as the official standard.
Comments
Comment #2
markhalliwellComment #3
truls1502I am sorry for my stupid question; what is the current status on the issue? Where can we help you regarding this issue? Any changes on remaining tasks or still the same?
Comment #4
markhalliwellIdk... this was a split from #2191525: [PP-1][policy, no patch] Extend Markdown coding standards to support API module (DOXYGEN).
From what I gathered in that issue, the actual adoption of CommonMark as the "official" markdown syntax was favored by the TWG.
However, they have not actually made it "official".
My guess is that they need to just need to reply to this issue and then mark it as "Fixed"
Then we can follow the above steps once it's been approved.
Comment #5
rodrigoaguileraIs this the proper issue queue to involve the TWG?
As I read on https://www.drupal.org/governance/technical-working-group
There should be an issue on their issue tracker to contact them. Do they also check this queue regularly?
I ended up here through the rabbit hole of having the README.md on a repo as the project description.
Comment #6
markhalliwellThis is the appropriate IQ for this topic.
I really don't understand, however, why this issue is taking so long to officially adopt.
Comment #7
markhalliwellAgain... ping...
I was under the impression that the TWG already, more or less, approved this?
Comment #8
Webbeh+1 to the need for this. Clarification per the request of #7 would be helpful for moving forward with #3012906: Add Markdown to list of module documentation file types, as I have encountered a lot of issues of the permutation of #3082868: Change README.txt to README.md.
Having this resolved would allow consensus and policy to be built to cascade down to revise, standardize the onslaught of contrib README.MD in-contrib documentation.
Comment #9
markhalliwellFWIW, I also (finally) just finished #2952435: Merge in the CommonMark project and released markdown 8.x-2.0-rc1.
Comment #10
cmlaraRunning across this issue while looking at coding standard to see if we had any for Markdown. This appears to have stalled during the period where there was no active Coding Standards committee. The newly reformed committee is doing a good job of working through active issues now.
I've updated the issue to use the new standard template to re-start this through the process.
Under the new rules this will need 3 "supporters" to put their name on the change. Setting to needs-work based on this requirement.
I will note I have a few concerns.
Here are some questions I was asking when reviewing CommonMark that I still do not have an 'always correct' answer for:
The specification essentially gave me a range for all of the above leaving it to me to decide what option I want to use. This isn't bad from a parser specification standpoint, however from a coding standard it allows for deviations even within the same project as each file may use different specifications.
To me CommonMark appears to be more of a parsing engine specification rather than a Coding standard. It obviously has its place to define the basis of what is acceptable within a limit, however because of its wide leeway it also doesn't necessarily provide a consistent policy across the ecosystem.
To make it more complicated, I was researching this as part of using mkdocs, which uses python-markdown, which advises that the original Markdown spec specifies 4 spaces indent https://python-markdown.github.io/#differences while CommonMark itself will accept 2-4 spaces.
Perhaps this wide specification is sufficient as a limit, and maybe even necessary given the wide range of Parsers available to render Markdown that we can't define a specific limit for some of these.
On a related note, it appears GitLab is using a CommonMark parser: https://about.gitlab.com/blog/2019/06/13/how-we-migrated-our-markdown-pr...
Comment #11
ressaThanks for reviving this issue, the README.md template is mostly aligned with GitLab Flavored Markdown (GLFM), and the consensus reached in the Discussion section.
Comment #12
christophweber commentedI agree with @cmlara in #10 and @ressa in #11. GitLab Flavored Markdown (GLFM) represents a decent and for practical purposes complete implementation of CommonMark. As GitLab users the Drupal community is best served by converging on GitLab Flavored Markdown, instead of trying to match the somewhat opaque CommonMark specification.
I will also note that an effort to document contrib projects in situ has been started: https://drupal.slack.com/archives/CGKLP028K/p1703059851634719
And there is some other related internal discussion as well.
All this to say that converging on a known MarkDown specification is going to be vital.
Comment #13
ressaThanks for sharing the link @ChristophWeber, but not everyone is on Slack, and it requires log in to read the content ... Would it be possible to copy-paste the relevant bits here? Or is there a page or issue on drupal.org?
Comment #14
cmlarahttps://www.drupal.org/docs/develop/git/using-gitlab-to-contribute-to-dr... is the relevant section of user guides on D.O.
Some of us are using this to move our docs into the repo (as oppose to the Documentation section of D.O.) for easier management of changes (change a feature you change the docs in the same commit) and wider distribution (the documentation ships with code making it available offline).
As noted in #10 mkdocs requires complying with Python Markdown specifications that are stricter than CommonMark. Mkdocs isn’t the only system (any static site generator can be used) however it is the one that is currently a part of the template. I’ve seen other non Drupal projects use mkdocs.
The gitlab_templates project is just started using this to document itself (WIP site) https://project.pages.drupalcode.org/gitlab_templates/.
Comment #15
mxr576#13 @ressa, let me Slack Dump it for you :)
Comment #16
ressa@cmlara:
This makes sense, and definitely makes it easier to keep code and docs in sync. Though, it could also be a blocker for updating the documentation, since an administrator needs to get involved when adding to, or updating it. But I guess, one platform (D.O docs vs. MkDocs) doesn't exclude the other, and for some projects one of them makes more sense, than the other. For example a niche, highly technical module should probably use MkDocs, whereas a module with lots of GUI configuration, D.O docs could be a better fit, allowing many users to create doc pages freely.
And by the way, about your questions about lists (#10), GitLab Flavored Markdown (GLFM) > Lists defines how to format them. This is also where "Bulleted lists denoted by dashes (
-)" and "Ordered lists use1" in README.md template come from.Awesome @mxr576, thanks!
It's so sad to me that all these great conversations on Slack are locked in a black box, and will over time disappear ... There are great nuggets of information and insight in there.
Somebody should create a Slack-scraper and paste the Drupal conversations into a "The Drupal Slack Daily" issue :)
Comment #17
mxr576You are not the only one with this idea, and probably AI could also help with summarizing these conversations ;)
Comment #18
ressaThat sounds wonderful, I hope it will happen! Though I don't think AI is needed here -- the raw messages would work well, both to have them accessible for reading, but also to get them indexed in the search engines, to make them findable.
Comment #19
quietone commentedIt is confusing that the current text section shows other issues. Skimming through I don't see that there is consensus on CommonMark. Since I think this needs more discussion I am changing the status to 'active'.
Comment #20
baluertlComment #21
borisson_I agree that there's not been consensus yet.
I don't think CommonMark allows for having tables, and I think that is an important extension to have. It is in Github and Gitlab flavored markdown, and given our integration with Gitlab, it might be a good idea to go for that?
Comment #22
ressaI agree, given that drupal.org issues will move to Gitlab, GitLab Flavored Markdown (GLFM) would be a better choice.
Perhaps we need to create a new issue "Adopt GitLab Flavored Markdown (GLFM) as standard for Markdown files"?
Or can we change the title in this issue, if that's where where the consensus seems to be? Then the discussion and arguments will not be spread over two Markdown issues ...
@balu_ertl: What do you think about that?
Comment #23
cmlaraIs GLFM a coding standard or a parser standard?
Is GLFM fully compatible with Python Markdown (goes back to the mkdocs discussion before)?
I’ve spent more time dealing with markdown since #10. My experience now is that it may be very hard to specify a coding standard and unlikely that we will find own pre-made.
There is a big difference between a coding standard and a parsing standard.
A coding standard dictates how detail must be laid out even though the language supports a diffrent layout, while a parser standard defines how it must be laid out to parse and any deviation will result in an error state:
To put the above in the form of an example:
PHP defines a parsing standard.
drupal/coder defines a coding standard.
Is it within the Coding Standards charter to define the use of a parser standard?
Comment #24
quietone commentedTo answer #23, the Coding Standards committee itself does not have a charter. It is considered part of The Technical Working Group (TWG). The Job of the TWG is given in the TWG Charter, which states, "to ensure that the necessary policies, procedures, and standards exist to address technical concerns affecting the Drupal community". That would cover making a decision about which style of Markdown to use.
And my personal view is that using the GitLab style makes the most sense.
Comment #25
quietone commentedThe comments here from 2024 onward accept the fact the community has chosen GitLab and then it follows that Drupal will be using GLFM. And that is what is happening. Various projects, including the Drupal governance and this project are moving documentation to GitLab pages.
That seems unnecessary because we have adopted GitLab. I think the other way, that is, if the community chose a markdown different than the default GitLab one, then it should be specified.
If I am not missing something to discuss, shall we close this at WAD?
Comment #26
cmlaraThe original request was to formally adopt a standard. That would mean this would still need a coding standards vote to adopt and update https://project.pages.drupalcode.org/coding_standards/ with new text. That would not be WAD, if nothing is to be formally adopted it would be "won't fix" which would be saying "each project may write markdown files however they want"
I will note the coding standards and Drupal governance project pages are not using GLFM, since the pages are generated by mkdocs they must align to python markdown, which is is different from and in some cases incompatible with, GLFM. #3521645: Formatting of PUWG charter mkdocs output is wrong is a real world example where parsing differences between GLFM and Python Markdown.
In #10 and #23 i mentioned that
Adopting GLFM is equivalent to saying "The coding standard for PHP files is the PHP engine specification", nothing about unified writing style has been said other than "the parser must not error'.
Here are a few questions that are related to standardized writing of markdown from the first couple pages of the GLFM specifications, each is a decision to make, each choice is valid, and each option can be mixed in the same file (and in some cases even the same line) and still be valid GLFM:
This is just a fraction of the choices that would need to be made to unify the writing of markdown files under a common style.
Edit: several typo’s of GLFM as GFLM
Comment #27
quietone commented@cmlara, You're right that 'won't fix' is a better choice. That was just a typing mistake on my part. To clarify a few points. per the approved process only issues that are RTBC and met the criteria are formally discussed by the committee. And the coding standard committee itself uses consensus style decision making, not voting.
Since the title here is to adopt a particular standard, the items at the end of the list in #26 should be in a separate issue.
We should al be aware that GLFM does use the CommonMark spec. According to Differences with standard Markdown
Is it not enough then to simply use GLFM?
Comment #28
quietone commentedSetting this to RTBC so it will be brought up at a committee meeting.
Comment #29
quietone commentedThis was brought up in this meeting #3549265: Coding Standards Meeting Wednesday 2025-10-29 0900 UTC. The members agreed to close this as won't fix for the reasons summarized in #27.
Thanks to everyone to help resolve this.