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

Support for code block wrapped with "~~~" #4612

Closed
Masynchin opened this issue Jul 15, 2023 · 7 comments
Closed

Support for code block wrapped with "~~~" #4612

Masynchin opened this issue Jul 15, 2023 · 7 comments
Assignees
Labels
bug Something isn't working fixed in next version (main) A fix has been implemented and will appear in an upcoming version

Comments

@Masynchin
Copy link

Type: Feature Request

In my python function's docstring I wrote a code block, wrapped with ~~~. Turns out, it doesn't recognized as code block, as opposed to ``` variant. I want to use both for code blocks.

Extension version: 2023.7.20
VS Code version: Code 1.80.0 (Universal) (660393deaaa6d1996740ff4880f1bad43768c814, 2023-07-04T13:39:33.766Z)
OS version: Darwin arm64 22.2.0
Modes:

@rchiodo
Copy link
Contributor

rchiodo commented Jul 17, 2023

Thanks for the issue but I'm not sure I understand what you're asking for. Can you describe a more concrete example?

Is it something like this?

def foo():
    '''
    Doc string goes here
    ~~~
    Code block goes here?
    ~~~
    '''

If that's what you're looking for, I believe we turn all doc strings into markdown. Markdown usually follows this format:

image

def foo():
   """
   Comment here:
   ```python
   def bar():
      pass
   ```
   """

@rchiodo
Copy link
Contributor

rchiodo commented Jul 17, 2023

Is there another tool that supports ~~~ for code blocks?

@rchiodo
Copy link
Contributor

rchiodo commented Jul 17, 2023

Oh maybe github does :)

def foo():
   pass

@rchiodo
Copy link
Contributor

rchiodo commented Jul 17, 2023

Typescript in VS code does too.

image

@rchiodo rchiodo added the bug Something isn't working label Jul 17, 2023
@rchiodo
Copy link
Contributor

rchiodo commented Jul 17, 2023

Okay seems like we should just support this as it seems to be a standard for other tools and languages.

@Masynchin
Copy link
Author

Yes, this is what I meant. I should have added this example:

def example():
    """
    Wrapped with backticks:

    ```python
    def function(a, b): ...
    ```

    Wrapped with tildas:

    ~~~python
    def function(a, b): ...
    ~~~
    """
Rendered signature of the function above

Here I want that both "backticks" and "tildas" versions were rendered as code block, but only first one is rendered correctly.

@PylanceBot PylanceBot added the fixed in next version (main) A fix has been implemented and will appear in an upcoming version label Jul 28, 2023
@rchiodo
Copy link
Contributor

rchiodo commented Jul 31, 2023

This issue has been fixed in prerelease version 2023.7.43, which we've just released. You can find the changelog here: CHANGELOG.md

@rchiodo rchiodo closed this as completed Jul 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed in next version (main) A fix has been implemented and will appear in an upcoming version
Projects
None yet
Development

No branches or pull requests

3 participants