more strict RST inline markup parsing (#17827)

* more strict RST inline markup parsing
* add test for unexpected bonus
* introduce `roPreferMarkdown`
This commit is contained in:
Andrey Makarov 2021-04-29 18:31:15 +03:00 • committed by GitHub
commit 1640508348
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 207 additions and 13 deletions

View file

@ -178,7 +178,8 @@ proc newDocumentor*(filename: AbsoluteFile; cache: IdentCache; conf: ConfigRef,
result.outDir = conf.outDir.string
initRstGenerator(result[], (if conf.cmd != cmdRst2tex: outHtml else: outLatex),
conf.configVars, filename.string,
{roSupportRawDirective, roSupportMarkdown, roNimFile},
{roSupportRawDirective, roSupportMarkdown,
roPreferMarkdown, roNimFile},
docgenFindFile, compilerMsgHandler)
if conf.configVars.hasKey("doc.googleAnalytics"):
@ -1380,7 +1381,9 @@ proc commandRstAux(cache: IdentCache, conf: ConfigRef;
d.isPureRst = true
var rst = parseRst(readFile(filen.string), filen.string,
line=LineRstInit, column=ColRstInit,
d.hasToc, {roSupportRawDirective, roSupportMarkdown}, conf)
d.hasToc,
{roSupportRawDirective, roSupportMarkdown, roPreferMarkdown},
conf)
var modDesc = newStringOfCap(30_000)
renderRstToOut(d[], rst, modDesc)
d.modDesc = rope(modDesc)