Compare commits

...
Sign in to create a new pull request.

1 commit

Author SHA1 Message Date
Joey Yakimowich-Payne
ebf7b2bb3a Change comments to markdown block 2020-05-13 20:02:46 -06:00

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``