-
Notifications
You must be signed in to change notification settings - Fork 649
Add a .markdownlintrc config file for Markdown file linter
#1011
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
mhucka
wants to merge
2
commits into
tensorflow:master
Choose a base branch
from
mhucka:add-markdownlintrc
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,147 @@ | ||
| { // -*- jsonc -*- | ||
| // | ||
| // Copyright 2026 The TensorFlow Authors. All Rights Reserved. | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // https://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| // Summary: config "markdownlint" to approximate TensorFlow's style (which in | ||
| // turn is close to https://google.github.io/styleguide/docguide/style.html). | ||
| // Note: there are multiple programs named "markdownlint" ; we use | ||
| // https://github.com/igorshubovych/markdownlint-cli/. | ||
|
|
||
| "$schema": "https://raw.githubusercontent.com/DavidAnson/markdownlint/main/schema/markdownlint-config-schema.json", | ||
|
|
||
| // Require ATX-style headings. | ||
| // https://google.github.io/styleguide/docguide/style.html#atx-style-headings | ||
| "headings": { | ||
| "style": "atx" | ||
| }, | ||
|
|
||
| // Google style does not require that the first line of a file is a heading | ||
| // for the title; it only states that the first heading should be a level 1. | ||
| // https://google.github.io/styleguide/docguide/style.html#document-layout | ||
| "first-line-heading": false, | ||
|
|
||
| // The Google style does not define what to do about trailing punctuation in | ||
| // headings. The markdownlint default disallows exclamation points, which | ||
| // seems likely to be more annoying than useful – I have definitely seen | ||
| // people use exclamation points in headings in README files on GitHub. | ||
| // This setting removes exclamation point from the banned characters. | ||
| "no-trailing-punctuation": { | ||
| "punctuation": ".,;:。,;:" | ||
| }, | ||
|
|
||
| // No trailing spaces. | ||
| // https://google.github.io/styleguide/docguide/style.html#trailing-whitespace | ||
| "whitespace": { | ||
| "br_spaces": 0 | ||
| }, | ||
|
|
||
| // Google style exempts some constructs from the line-length limit. | ||
| "line-length": { | ||
| "line_length": 80, | ||
| "code_block_line_length": 80, | ||
| "heading_line_length": 80, | ||
| "code_blocks": false, | ||
| "headings": false, | ||
| "tables": false | ||
| }, | ||
|
|
||
| // Google Markdown style specifies 2 spaces after item numbers, 3 spaces | ||
| // after bullets, so that the text itself is consistently indented 4 spaces. | ||
| // https://google.github.io/styleguide/docguide/style.html#nested-list-spacing | ||
| "list-marker-space": { | ||
| "ol_multi": 2, | ||
| "ol_single": 2, | ||
| "ul_multi": 3, | ||
| "ul_single": 3 | ||
| }, | ||
|
|
||
| "ul-indent": { | ||
| "indent": 4 | ||
| }, | ||
|
|
||
| // Bare URLs are allowed in GitHub-flavored Markdown and in Google’s style. | ||
| "no-bare-urls": false, | ||
|
|
||
| // Basic Markdown allows raw HTML. Both GitHub & PyPI support subsets of | ||
| // HTML, though it's unclear what subset PyPI supports. Google's style guide | ||
| // recommends against using raw HTML, but does allow it. (C.f. the bottom of | ||
| // https://google.github.io/styleguide/docguide/style.html) Google's in-house | ||
| // documentation system allows many inline and block-level tags, but strips | ||
| // others that can pose security risks (e.g., <object> and standalone <svg>). | ||
| // The list below tries to capture the intersection of what GitHub allows | ||
| // (c.f. https://github.com/github/markup/issues/245#issuecomment-682231577), | ||
| // what PyPI seems to allow, what Google allows, and what seems likely to be | ||
| // most useful in situations where someone needs to reach for HTML. | ||
| "html": { | ||
| "allowed_elements": [ | ||
| "a", | ||
| "abbr", | ||
| "b", | ||
| "blockquote", | ||
| "br", | ||
| "caption", | ||
| "cite", | ||
| "code", | ||
| "dd", | ||
| "del", | ||
| "details", | ||
| "dfn", | ||
| "div", | ||
| "dl", | ||
| "dt", | ||
| "em", | ||
| "figcaption", | ||
| "figure", | ||
| "h1", | ||
| "h2", | ||
| "h3", | ||
| "h4", | ||
| "h5", | ||
| "h6", | ||
| "hr", | ||
| "i", | ||
| "img", | ||
| "ins", | ||
| "kbd", | ||
| "li", | ||
| "mark", | ||
| "ol", | ||
| "p", | ||
| "picture", | ||
| "pre", | ||
| "q", | ||
| "s", | ||
| "samp", | ||
| "small", | ||
| "span", | ||
| "strong", | ||
| "sub", | ||
| "summary", | ||
| "sup", | ||
| "table", | ||
| "tbody", | ||
| "td", | ||
| "tfoot", | ||
| "th", | ||
| "thead", | ||
| "time", | ||
| "tr", | ||
| "tt", | ||
| "ul", | ||
| "var", | ||
| "wbr" | ||
| ] | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is named
.markdownlintrc, but it contains comments, which makes it invalid JSON. According to themarkdownlint-clidocumentation (which this PR aims to support), a.markdownlintrcfile is parsed as standard JSON. The comments will cause a parsing failure when the linter tries to load this configuration.To make this configuration file functional, it needs to be valid JSON. Please remove all comments.