Skip to content
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

Markdownlint: Add custom rule "Use full language name for fenced code blocks" #27723

Conversation

MaoShizhong
Copy link
Contributor

Because

#27720 will have the layout style guide specify that any code block with languages set must use the full language name if there is both a full and abbreviated form that work. For example, using javascript instead of js, even if js will work fine.

There is no built-in rule for this, other than an array of languages to accept, which is much clunkier than an option to exclude specific languages.

Therefore, it would be better to write a custom rule that detects abbreviated languages for those we might expect to see in our lesson files (rb, js, md, txt) and flags, advising the use of the respective full name instead (ruby, javascript, markdown, text).

Languages like html and css, which do not have a valid full name option (and would be hell to type anyway), are exempt from this rule.

This PR

  • Adds TOP006 rule
  • Adds TOP006_test file, demonstrating how the rule works
  • Adds TOP006 doc file
  • Adds TOP006 as a custom rule to the markdownlint config file

Issue

Closes #27721

Additional Information

N/A

Pull Request Requirements

  • I have thoroughly read and understand The Odin Project Contributing Guide
  • The title of this PR follows the location of change: brief description of change format, e.g. Intro to HTML and CSS lesson: Fix link text
  • The Because section summarizes the reason for this PR
  • The This PR section has a bullet point list describing the changes in this PR
  • If this PR addresses an open issue, it is linked in the Issue section
  • If any lesson files are included in this PR, they have been previewed with the Markdown preview tool to ensure it is formatted correctly
  • If any lesson files are included in this PR, they follow the Layout Style Guide

@MaoShizhong MaoShizhong merged commit 16c13cb into TheOdinProject:main Mar 31, 2024
2 of 3 checks passed
@MaoShizhong MaoShizhong deleted the feature/mdlint-use-long-fenced-code-language branch March 31, 2024 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New Markdownlint rule: Use long language name for codeblocks
2 participants