Skip to content

Add a .markdownlintrc config file for Markdown file linter#1011

Draft
mhucka wants to merge 1 commit intotensorflow:masterfrom
mhucka:add-markdownlintrc
Draft

Add a .markdownlintrc config file for Markdown file linter#1011
mhucka wants to merge 1 commit intotensorflow:masterfrom
mhucka:add-markdownlintrc

Conversation

@mhucka
Copy link
Member

@mhucka mhucka commented Mar 10, 2026

In preparation for more work on documentation, and to help contributors get the formatting right, this adds a config file for the program markdownlint that tries to stay close to TensorFlow's documentation style and Google's Markdown Style Guide.

Note: there is currently no script to run markdownlint or checks in CI. Those can come later. This config file nevertheless helps people get the right settings in their editors and makes it possible to use a markdownlint pre-commit hook for git.

Add a config for `markdownlint` that tries to stay close to TensorFlow's
documentation style and Google's Markdown Style Guide.
@gemini-code-assist
Copy link

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a configuration file for markdownlint to standardize Markdown formatting across the project. Its primary goal is to align documentation with established style guides, making it easier for contributors to maintain consistency and improving the overall quality of project documentation.

Highlights

  • Markdown Linting Configuration: Added a .markdownlintrc file to enforce a consistent Markdown style, approximating TensorFlow's documentation style and Google's Markdown Style Guide. This helps contributors with formatting and prepares for future documentation work.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • .markdownlintrc
    • Added a new configuration file for markdownlint.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a .markdownlintrc configuration file to enforce a consistent style for Markdown documents, aligning with TensorFlow and Google style guides. The configuration is well-structured and documented with comments. However, the use of comments in a .markdownlintrc file will cause parsing errors with markdownlint-cli, as it expects a standard JSON format. My review includes a suggestion to remove the comments to make the file valid.

Comment on lines +1 to +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"
]
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This file is named .markdownlintrc, but it contains comments, which makes it invalid JSON. According to the markdownlint-cli documentation (which this PR aims to support), a .markdownlintrc file 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.

{
  "$schema": "https://raw.githubusercontent.com/DavidAnson/markdownlint/main/schema/markdownlint-config-schema.json",

  "headings": {
    "style": "atx"
  },

  "first-line-heading": false,

  "no-trailing-punctuation": {
    "punctuation": ".,;:。,;:"
  },

  "whitespace": {
    "br_spaces": 0
  },

  "line-length": {
    "line_length": 80,
    "code_block_line_length": 80,
    "heading_line_length": 80,
    "code_blocks": false,
    "headings": false,
    "tables": false
  },

  "list-marker-space": {
    "ol_multi": 2,
    "ol_single": 2,
    "ul_multi": 3,
    "ul_single": 3
  },

  "ul-indent": {
    "indent": 4
  },

  "no-bare-urls": false,

  "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"
    ]
  }
}

@mhucka mhucka added area/docs Involves documentation – problems, ideas, requests area/health Involves general matters of project configuration, health, maintenance, and similar concerns labels Mar 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/docs Involves documentation – problems, ideas, requests area/health Involves general matters of project configuration, health, maintenance, and similar concerns

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant