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

Rule MD044 - option to skip over inline code references #1277

Closed
3 tasks done
glennmatthews opened this issue Dec 6, 2024 · 5 comments
Closed
3 tasks done

Rule MD044 - option to skip over inline code references #1277

glennmatthews opened this issue Dec 6, 2024 · 5 comments

Comments

@glennmatthews
Copy link

Prerequisites

  • Are you running the latest version of this application?
  • Have you checked the Frequently Asked Questions document?
  • Did you perform a cursory search of other issues to look for related issues?

Feature Request

Description

In addition to the current feature of being able to skip MD044 (proper-names) enforcement in standalone code blocks, it would be very useful to also have an option to disable its enforcement in inline code (i.e. delimited by backticks). This would allow for common documentation patterns like references to Python modules and packages by their literal names without this being flagged as an error.

Desired Behavior of Feature

A new boolean configuration knob in rule MD044, similar to code_blocks - perhaps inline_code? This knob would default to True, in which case the current rule behavior would remain. However, when set to False, the rule would skip over any text marked as inline code, and not check such text for proper-name validity.

For example when referencing Django code we could add Django as a proper name and still have the below be considered valid:

To write unit tests in Django, you should import `TestCase` from `django.test` instead of from `unittest`.

Or, for PyMarkdown itself:

PyMarkdown is implemented in the `pymarkdown` Python module.

What Are the Benefits of This Feature?

Currently I'm hard-pressed to consider adding names in my MD044 configuration because nearly every proper noun I'd like to reference in my documentation has one proper-name form when writing colloquially and a different, usually all-lower-case, form when referenced as code. I'd have to add a tremendous number of pragma statements in my documentation to account for this.

@jackdewinter
Copy link
Owner

Honest question: I think this suggestion has merit. Would it be useful to have a "mirror" rule that would only work inside of code blocks and/or inline code?

Based on the reading of your statement, it seems like it would also be useful to have "django" be on a list, possibly with some rules saying when it should be "django" and when "Django". Thoughts?

@glennmatthews
Copy link
Author

Thanks for the response! I do think it'd be interesting to have a similar rule within code blocks/inline code, let's call it MD0xx for the sake of example. I don't know that there's necessarily a direct mapping from one to the other, so they'd probably still need to be separate config settings.

MD044 (non-code) config could include:

names: Django,PyMarkdown,Jinja2,REST API,Django REST Framework

MD0xx (code) config could include:

names: django,pymarkdown,jinja2,api,rest_framework

However I personally think that MD0xx would be a lower priority to implement than the enhancement to MD044 described above - at least from my personal perspective as primarily a coder rather than a docs-writer, I'm much more likely to get the capitalization "correct" in code references than I am in free-text documentation. :-)

@jackdewinter
Copy link
Owner

completed, will be in the next release.

@jackdewinter
Copy link
Owner

just published a new release. can you verify if this is working as intended?

@glennmatthews
Copy link
Author

Looks like it works great! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants