Skip to content

Commit db8c83c

Browse files
committed
feat: support QDoc
QDoc is Qt's documentation markup: LaTeX-style commands inside comment blocks, in C++ sources or standalone .qdoc files. A converter now reads it into what the walker already understands -- sections are headings, `\c` is a code span, `\note` is a classed paragraph a rule can target, topic and quoting commands are markup with nothing to lint, and an unknown command is masked with its text kept. Doc comments in C++ sources lint through `[formats] cpp = qdoc`, with alerts mapped back to the source. Closes #784. Signed-off-by: Joseph Kato <joseph@jdkato.io>
1 parent fca7b79 commit db8c83c

8 files changed

Lines changed: 680 additions & 0 deletions

File tree

‎internal/core/format.go‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ var FormatByExtension = map[string][]string{
7575
`\.(?:md|mdown|markdown|markdn|[Rr]md)$`: {".md", "markup"},
7676
`\.(?:mdx)$`: {".mdx", "markup"},
7777
`\.(?:myst)$`: {".myst", "markup"},
78+
`\.(?:qdoc)$`: {".qdoc", "markup"},
7879
`\.(?:qmd)$`: {".qmd", "markup"},
7980
`\.(?:org)$`: {".org", "markup"},
8081
`\.(?:php)$`: {".php", "code"},

‎internal/lint/fragment.go‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ func (l *Linter) lintFragments(f *core.File) error {
107107
err = l.lintADoc(f)
108108
case ".org":
109109
err = l.lintOrg(f)
110+
case ".qdoc":
111+
err = l.lintQDoc(f)
110112
default:
111113
return fmt.Errorf("unsupported markup format '%s'", f.NormedExt)
112114
}

‎internal/lint/html.go‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ var blockDelimiters = map[string]string{
3333
".md": "\n```\n$1\n```\n",
3434
".mdx": "\n```\n$1\n```\n",
3535
".myst": "\n```\n$1\n```\n",
36+
".qdoc": "\n\\code\n$1\n\\endcode\n",
3637
".qmd": "\n```\n$1\n```\n",
3738
".rst": "\n::\n\n%s\n",
3839
".org": orgExample,
@@ -87,6 +88,7 @@ var inlineDelimiters = map[string]string{
8788
".md": "`$1`",
8889
".mdx": "`$1`",
8990
".myst": "`$1`",
91+
".qdoc": `\c {$1}`,
9092
".qmd": "`$1`",
9193
".rst": "``$1``",
9294
".org": "=$1=",

‎internal/lint/lint.go‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,8 @@ func (l *Linter) lintFile(src string) lintResult {
244244
err = l.lintMDX(file)
245245
case ".myst":
246246
err = l.lintMyST(file)
247+
case ".qdoc":
248+
err = l.lintQDoc(file)
247249
case ".qmd":
248250
err = l.lintQuarto(file)
249251
case ".rst":

0 commit comments

Comments
 (0)