Skip to content

linters/markdownlint-rules/plugin-name-as-code

markdownlint rule: plugin-name-as-code.

Reports an Obsidian plugin’s display name written as plain text in markdown, and fixes it by wrapping the name in backticks. The names come from plugin-names.ts: the shared list, the project’s own manifest.json name, and the rule’s additionalPluginNames option.

Only prose is read: the data tokens micromark leaves in paragraphs, lists, tables and emphasis. Everything else is left alone because a code span there would be wrong or would change something:

  • code spans, fenced and indented code and math are not data tokens, so they are never reached; - an HTML block, whose content markdownlint parses again as markdown; - a link or image label and target, a reference definition and an autolink: a code span inside a link label renders inconsistently across GitHub, Obsidian and terminals; - a heading, whose anchor would change; - a block quote, which quotes somebody else’s words; - an Obsidian [[wikilink]] and an inline <code> element, which micromark reads as plain text, and a bare URL.

An inline quotation is NOT skipped, on purpose. A double-quoted span in prose cannot be told apart from our own quoted text: a step, a button label or a scare quote such as “install CodeScript Toolkit” is ours and must be marked, while somebody else’s words quoted inline must stay as they wrote them. Our own kind is the commoner one, so skipping every quoted span would exempt our own prose to spare the rare real quotation. A real quotation inline carries <!-- markdownlint-disable-line plugin-name-as-code -- quotes the reporter --> instead, which names the exception and its reason where it is.

Not attempted: a multi-word name broken across two lines of one paragraph.

Variable Description
PLUGIN_NAME_AS_CODE_RULE_NAME The rule’s name, as it is spelled in a markdownlint-cli2 configuration.
pluginNameAsCodeRule A markdownlint rule requiring a plugin name in markdown to be marked as code.