Change comments to markdown block

This commit is contained in:
Joey Yakimowich-Payne 2020-05-13 20:02:46 -06:00
commit ebf7b2bb3a

View file

@ -269,12 +269,13 @@ proc getCommentsStr*(gState: State, commentNodes: seq[TSNode]): string =
## Generate a comment from a set of comment nodes. Comment is guaranteed
## to be able to be rendered using nim doc
if commentNodes.len > 0:
result = "::"
result = "```"
for commentNode in commentNodes:
result &= "\n " & gState.getNodeVal(commentNode).strip()
result = result.replace(re" *(//|/\*\*|\*\*/|/\*|\*/|\*)", "")
result = result.multiReplace([("\n", "\n "), ("`", "")]).strip()
result = result.multiReplace([("\n", "\n ")]).strip()
result &= "\n```"
proc getCommentNodes*(gState: State, node: TSNode, maxSearch=1): seq[TSNode] =
## Get a set of comment nodes in order of priority. Will search up to ``maxSearch``