Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some characters rendered incorrectly in Markdown comments when inline/block code is used #11322

Closed
bshoshany opened this issue Aug 15, 2023 · 8 comments
Assignees
Labels
bug Feature: Doc comments An issue related to code comments shown in hover, completion, and signature help. fixed Check the Milestone for the release in which the fix is or will be available. Language Service regression A bug that didn't exist in a previous release
Milestone

Comments

@bshoshany
Copy link

Environment

  • OS and Version: Windows 11 v22621.2134
  • VS Code Version: 1.81.1
  • C/C++ Extension Version: 1.17.2

Bug Summary and Steps to Reproduce

Bug Summary:

Thanks for adding this feature following issue #6020! It is very useful, but there are a few kinks to iron out.

  1. Some characters such as <, >, and _ within inline code or fenced code blocks in Markdown comments are incorrectly rendered with an escape character in front, e.g. \<, \>, and \_.
  2. Indentation is not preserved in fenced code blocks, hindering readability.

Steps to reproduce:

Create the following sample program:

#include <iostream>
#include <vector>

// This function returns an `std::vector<size_t>` with `n` elements initialized to consecutive values.
//
// Usage example:
// ```
// std::vector<size_t> vec;
// vec = test();
// ```
std::vector<size_t> test(const size_t n)
{
    std::vector<size_t> temp(32);
    for (size_t i = 0; i < n; ++i)
        temp[i] = i;
    return temp;
}

int main()
{
    std::vector<size_t> vec = test(32);
    for (const size_t k : vec)
        std::cout << k << ' ';
}

Expected behavior: The Markdown comment should be rendered correctly.

Actual behavior: See screenshot.

image

Configuration and Logs

I don't think any of these are relevant since the problem is just with Markdown rendering and not actual code, but I can attach them later if needed.

Other Extensions

No response

Additional context

No response

@bobbrow
Copy link
Member

bobbrow commented Aug 15, 2023

Thanks for reporting this. We'll get it fixed.

@bobbrow bobbrow added this to the On Deck milestone Aug 15, 2023
@bobbrow bobbrow added bug Language Service Feature: Doc comments An issue related to code comments shown in hover, completion, and signature help. labels Aug 15, 2023
@bshoshany
Copy link
Author

Great, thank you! :)

@sean-mcmanus sean-mcmanus added the regression A bug that didn't exist in a previous release label Aug 15, 2023
@sean-mcmanus sean-mcmanus modified the milestones: On Deck, 1.18 Aug 15, 2023
@sean-mcmanus sean-mcmanus modified the milestones: 1.18, 1.17.3 Aug 15, 2023
@sean-mcmanus sean-mcmanus modified the milestones: 1.17.4, 1.17.5 Aug 21, 2023
@michelleangela michelleangela added the fixed Check the Milestone for the release in which the fix is or will be available. label Aug 25, 2023
@bobbrow
Copy link
Member

bobbrow commented Aug 28, 2023

The fix for this is available in 1.17.5

@bobbrow bobbrow closed this as completed Aug 28, 2023
@bshoshany
Copy link
Author

Awesome, thanks! However, the indentation in fenced code blocks still doesn't show correctly. My apologies, this is totally my fault - the code I put in my original comment isn't the right code. It doesn't match the screenshot and doesn't properly demonstrate the issue. I fixed it now.

In 1.17.5 the first problem I mentioned (some characters are rendered with a redundant escape character) is fixed, but the fenced code blocks are still not correctly indented - see screenshot:

image

The for loop should be indented for readability, but it is not. Would it be possible to fix this? Thanks again.

@bobbrow
Copy link
Member

bobbrow commented Aug 29, 2023

@browntarik does our comment parser eat all the leading whitespace? If so, we should open a new bug to tell it to stop eating whitespace between backticks so that the VS Code markdown renderer can do the right thing. If not, then we need to forward this bug on to the VS Code team.

@sean-mcmanus
Copy link
Contributor

I think it's our comment processing code since TypeScript doesn't repro the issue. Would the new bug be for 1.18.0 or 1.17.6?

@bobbrow
Copy link
Member

bobbrow commented Aug 29, 2023

1.18.0

@bobbrow
Copy link
Member

bobbrow commented Aug 29, 2023

This is tracked by #11379 now

@github-actions github-actions bot locked and limited conversation to collaborators Oct 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Feature: Doc comments An issue related to code comments shown in hover, completion, and signature help. fixed Check the Milestone for the release in which the fix is or will be available. Language Service regression A bug that didn't exist in a previous release
Projects
None yet
Development

No branches or pull requests

5 participants