Giter Site home page Giter Site logo

markdownlint-rule-titlecase's Introduction

markdownlint-rule-titlecase

Custom title case rule for markdownlint headers

npm

Usage

Once installed using npm install markdownlint-rule-titlecase, run markdownlint with --rules "markdownlint-rule-titlecase":

$ markdownlint . --rules "markdownlint-rule-titlecase"

chapters/00-introduction.md:60 titlecase-rule Titlecase rule [Title Case: 'Expected ### How Skilled Do I Need to Be in Python to Use This Book?, found ### How skilled do I need to be in Python to use this book?']
chapters/00-introduction.md:64 titlecase-rule Titlecase rule [Title Case: 'Expected ### Do I Need to Know C to Use This Book?, found ### Do I Need to Know C to Use This book?']
chapters/00-introduction.md:74 titlecase-rule Titlecase rule [Title Case: 'Expected ### Won't The Content in This Book Be Out of Date Really Quickly?, found ### Won't The Content in This Book be Out of Date Really Quickly?']

markdownlint-rule-titlecase's People

Contributors

tonybaloney avatar

Stargazers

Hang avatar Oliver Kopp avatar Pavel avatar Harish Ranganathan avatar

Watchers

Aaron Stannard avatar James Cloos avatar  avatar  avatar

Forkers

somacdivad dbader

markdownlint-rule-titlecase's Issues

Fixing violations of this rule always deletes the first character of the line

Looks like the fixInfo object is hard-coded to delete the first character of the line:

{
"editColumn": column,
"deleteCount": length
}

If a rule isn't able to fix an issue, it can simply omit the fixInfo object.

Here's a demonstration of the problem:

C:\T\title-case-issue>npm ls --depth 0
C:\T\title-case-issue
+-- [email protected]
`-- [email protected]

C:\T\title-case-issue>type demo.md
# heading

Text

C:\T\title-case-issue>type .markdownlint-cli2.jsonc
{
  "customRules": [
    "markdownlint-rule-titlecase"
  ]
}

C:\T\title-case-issue>node_modules\.bin\markdownlint-cli2 demo.md
demo.md:1:1 titlecase-rule Titlecase rule [Title Case: 'Expected # Heading, found # heading']

C:\T\title-case-issue>notepad .markdownlint-cli2.jsonc

C:\T\title-case-issue>type .markdownlint-cli2.jsonc
{
  "customRules": [
    "markdownlint-rule-titlecase"
  ],
  "fix": true
}

C:\T\title-case-issue>node_modules\.bin\markdownlint-cli2 demo.md
demo.md:1 MD041/first-line-heading/first-line-h1 First line in file should be a top level heading [Context: " heading"]

C:\T\title-case-issue>type demo.md
 heading

Text

C:\T\title-case-issue>

Compatibility with config files?

Thanks for this!

I saw that we can run the rule explicitly, e.g.:

markdownlint "docs/**/*.md" --rules "markdownlint-rule-titlecase"

However, is there a way to incorporate it into the .markdownlintrc or markdownlint.json files such as those used by the CLI?

I'd love to be able to not have to explicitly specify it and instead rely on the config file itself.

Let me know if this is an issue best taken up with the CLI project itself.

Thanks again!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.