You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Markdown comment support for tooltip display of hover #6020
VS Code inherently supports markdown in doc comments, but we added code to explicitly disable/escape it for code that has comments that are not intended to be interpreted as markdown. We'd need to add a setting to re-enable the markdown.
Reacted by Sergei Kashlikov, Zilog80a, Coziyu, Paweł Syska and joule19
Following Sean McManus (@sean-mcmanus)'s response above.. Where can we re-enable that in code? I was trying to tweak files in ~/.vscode/extensions/ms-vscode.cpptools-1.0.1 so I can render the comment in Markdown without having to wait for a new Cpptools release :) It looks we just need to delete the code that is used to "explicitly disable/escape" Markdown.
The markdown escaping is done in our closed source cpptools process. I haven't looked into whether there's a way to undo the escaping via the open source TypeScript.
We'd need to add a setting to re-enable the markdown.
I was surprised that there isn't a way to get markdown formatting already. We use this feature in other languages to great effect. Would very much love to see it enabled in C/C++.
Reacted by Sergei Kashlikov, kmasa-kyo, Daniel Atanasov, Nick Liu, Jonathan Woolf, Dylan Bargatze, Coziyu, Barak Shoshany, Tomas Vaner, Hristo Hristov and 4 more
Hi Sean McManus (@sean-mcmanus), I came here to request this exact same feature and found that it was already requested. It's been almost 2 years since this issue opened and more than a year since the last reply, I wonder if any progress has been made into enabling Markdown comments in C/C++? This would be extremely helpful in writing more meaningful and informative code documentation for my C++ libraries. Thanks!
Sean McManus (@sean-mcmanus), thank you so much for your quick reply. I understand that this is not a high-priority issue. However, from your post above, if I understand correctly, it sounds like allowing Markdown comments is a simple matter of re-enabling something that was disabled. If that is indeed the case, I wonder if perhaps you could consider putting this issue at a higher priority, since it is a low-effort fix?
It looks like it would be a medium effort fix. There's problems with how to combine the cpp formatted comments with the markdown comments and how to deal with potential security issues with exposing links in the comments.
Waiting for this feature actually. Because if comments would support markdown, the issue with multiline comments becoming one line text in the tooltip would be resolved.
And I need multiline text in my documentation ;)
Found out that my issue of using HTML tags within doxygen-styled comments for C++ can be related to the issue discussed here. Any chance to have soon markdown support (including HTML) for tooltip display of hover? :-)
joule19 No, HTML would not be supported. Markdown is supported because that is what VS Code will process/render, i.e. I think VS Code itself would need to add support for that.
There is still space to improve. It looks like in section every new line is removed, every line trimmed and joind with space. Not usable:
lists
code blocks
/// ACTUAL - every section is paragraph | IDEAL - every section is markdown document/// @brief This is a markdown test for doxygen hover | @brief This is a markdown test for doxygen hover/// |/// @details | @details/// No way to to simple start new paragraph - only by duplicate | Simple way to to start new paragraph - by empty line/// doxygen section | doxygen section/// |/// This paragraph is joined | This paragraph is not joined/// @details |/// New paragraph | New paragraph/// @details |/// Another paragraph | Another paragraph/// @details |/// __Bold__ _italic_ `inline code` - works as expected | __Bold__ _italic_ `inline code` - works as expected/// |/// @details | Code block should be rendered render as actual block code/// Code block is rendered render as inline code |/// even on it's own section |/// @details | ```c/// ```c | puts("Hello World");/// puts("Hello World"); | system("pause");/// system("pause"); | ```/// ``` |/// @note | @note /// Test markdown lists - again whole section is treated | Test markdown lists - whole section is markdown document/// as single paragraph | as single paragraph /// @note |/// - item1 | - item1 /// - subitem | - subitem /// - item 2 | - item 2 intvariable;
Sylwester Nakonieczny (@naksyl) For the new line problem, there's a separate issue at #10039 with a VS "feature request" ticket for it open here. Apparently it's a "design choice" to show line breaks as spaces instead of actual new lines, regardless of how many new lines we use in between.
Code blocks also don't seem to be fully supported, but IIRC, if there's no explicit DOxygen tags inside the comment, the code block shows up in the same format as the actual body of the editor. This seems to be a similar behaviour to the new line problem, where, if we don't use DOxygen tags, the newlines are displayed as actual new lines instead of spaces.
My personal hunch is that, without DOxygen tags, the comments are rendered as regular comments with line breaks and code block formatting, but as soon as a DOxygen tag is introduced, those functionality are suppressed.
UPDATE: Got a screenshot of code blocks working if there aren't any DOxygen tags!
I suppose the astericks and underscore are shown with a preceding backslash as an escape sequence. If I add the backslash in the comment itself, the hover breaks at that character and doesn't show anything afterwards.
Activity
sean-mcmanus commentedon Aug 25, 2020
VS Code inherently supports markdown in doc comments, but we added code to explicitly disable/escape it for code that has comments that are not intended to be interpreted as markdown. We'd need to add a setting to re-enable the markdown.
Leedehai commentedon Oct 4, 2020
Following Sean McManus (@sean-mcmanus)'s response above.. Where can we re-enable that in code? I was trying to tweak files in ~/.vscode/extensions/ms-vscode.cpptools-1.0.1 so I can render the comment in Markdown without having to wait for a new Cpptools release :) It looks we just need to delete the code that is used to "explicitly disable/escape" Markdown.
sean-mcmanus commentedon Oct 5, 2020
The markdown escaping is done in our closed source cpptools process. I haven't looked into whether there's a way to undo the escaping via the open source TypeScript.
ericdrobinson commentedon Jun 8, 2021
I was surprised that there isn't a way to get markdown formatting already. We use this feature in other languages to great effect. Would very much love to see it enabled in C/C++.
bshoshany commentedon Jul 26, 2022
Hi Sean McManus (@sean-mcmanus), I came here to request this exact same feature and found that it was already requested. It's been almost 2 years since this issue opened and more than a year since the last reply, I wonder if any progress has been made into enabling Markdown comments in C/C++? This would be extremely helpful in writing more meaningful and informative code documentation for my C++ libraries. Thanks!
sean-mcmanus commentedon Jul 26, 2022
Barak Shoshany (@bshoshany) There hasn't been any progress yet. If you see this issue get assigned to a milestone then you could expect progress.
bshoshany commentedon Jul 26, 2022
Sean McManus (@sean-mcmanus), thank you so much for your quick reply. I understand that this is not a high-priority issue. However, from your post above, if I understand correctly, it sounds like allowing Markdown comments is a simple matter of re-enabling something that was disabled. If that is indeed the case, I wonder if perhaps you could consider putting this issue at a higher priority, since it is a low-effort fix?
sean-mcmanus commentedon Jul 26, 2022
It looks like it would be a medium effort fix. There's problems with how to combine the cpp formatted comments with the markdown comments and how to deal with potential security issues with exposing links in the comments.
bshoshany commentedon Jul 27, 2022
I see, thanks for explaining. I hope it gets implemented soon, as it would be a very helpful feature.
pauljurczak commentedon Jul 27, 2022
Ignore the links. Display them as a text.
TomasVaner commentedon Jul 27, 2022
Waiting for this feature actually. Because if comments would support markdown, the issue with multiline comments becoming one line text in the tooltip would be resolved.
And I need multiline text in my documentation ;)
15 remaining items
starball5 commentedon Apr 28, 2023
Related on Stack Overflow: Using C/C++ in VS Code, how can I create lists and tables within tooltip description of symbols?.
joule19 commentedon May 23, 2023
Found out that my issue of using HTML tags within doxygen-styled comments for C++ can be related to the issue discussed here. Any chance to have soon markdown support (including HTML) for tooltip display of hover? :-)
sean-mcmanus commentedon May 23, 2023
joule19 No, HTML would not be supported. Markdown is supported because that is what VS Code will process/render, i.e. I think VS Code itself would need to add support for that.
michelleangela commentedon Jul 27, 2023
Fix available in pre-release https://github.com/microsoft/vscode-cpptools/releases/tag/v1.17.0.
naksyl commentedon Jul 29, 2023
There is still space to improve. It looks like in section every new line is removed, every line trimmed and joind with space. Not usable:
thekpaul commentedon Jul 29, 2023
Sylwester Nakonieczny (@naksyl) For the new line problem, there's a separate issue at #10039 with a VS "feature request" ticket for it open here. Apparently it's a "design choice" to show line breaks as spaces instead of actual new lines, regardless of how many new lines we use in between.
Code blocks also don't seem to be fully supported, but IIRC, if there's no explicit DOxygen tags inside the comment, the code block shows up in the same format as the actual body of the editor. This seems to be a similar behaviour to the new line problem, where, if we don't use DOxygen tags, the newlines are displayed as actual new lines instead of spaces.
My personal hunch is that, without DOxygen tags, the comments are rendered as regular comments with line breaks and code block formatting, but as soon as a DOxygen tag is introduced, those functionality are suppressed.
UPDATE: Got a screenshot of code blocks working if there aren't any DOxygen tags!

I suppose the astericks and underscore are shown with a preceding backslash as an escape sequence. If I add the backslash in the comment itself, the hover breaks at that character and doesn't show anything afterwards.
naksyl commentedon Aug 5, 2023
Ok, I misunderstood this markdown feature. It works for plain comments (no doxygen tags) - even tables.
mea culpa
michelleangela commentedon Aug 14, 2023
Fixed in release version https://github.com/microsoft/vscode-cpptools/releases/tag/v1.17.2.