enable syntax highlighting for inline code (#17585)
* enable syntax highlighting for inline code * finish '.. default-role' and preliminary '.. role' implementation * more compact check in dirRole * set :literal: as default role for *.rst * Update lib/packages/docutils/rst.nim Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> * use whichRole for setting currRoleKind * Update lib/packages/docutils/rst.nim Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> * rename rnGeneralRole -> rnUnknownRole Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
This commit is contained in:
parent
07991d902e
commit
e35946f306
9 changed files with 239 additions and 51 deletions
|
|
@ -55,12 +55,15 @@ type
|
|||
# * `file#id <file#id>`_
|
||||
# * `file#id <file#id>'_
|
||||
rnSubstitutionDef, # a definition of a substitution
|
||||
rnGeneralRole, # Inline markup:
|
||||
# Inline markup:
|
||||
rnInlineCode,
|
||||
rnUnknownRole, # interpreted text with an unknown role
|
||||
rnSub, rnSup, rnIdx,
|
||||
rnEmphasis, # "*"
|
||||
rnStrongEmphasis, # "**"
|
||||
rnTripleEmphasis, # "***"
|
||||
rnInterpretedText, # "`"
|
||||
rnInterpretedText, # "`" an auxiliary role for parsing that will
|
||||
# be converted into other kinds like rnInlineCode
|
||||
rnInlineLiteral, # "``"
|
||||
rnInlineTarget, # "_`target`"
|
||||
rnSubstitutionReferences, # "|"
|
||||
|
|
@ -252,7 +255,7 @@ proc renderRstToRst(d: var RenderContext, n: PRstNode, result: var string) =
|
|||
result.add(" <")
|
||||
renderRstToRst(d, n.sons[1], result)
|
||||
result.add(">`_")
|
||||
of rnGeneralRole:
|
||||
of rnUnknownRole:
|
||||
result.add('`')
|
||||
renderRstToRst(d, n.sons[0],result)
|
||||
result.add("`:")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue