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

Lines started with # in code block being recognized as markdown title #1490

Open
IsaacXen opened this issue May 27, 2023 · 0 comments
Open
Labels
request feature requests from users syntax highlight issues related to syntax highlighting

Comments

@IsaacXen
Copy link

Description

When using markdown syntax, lines started with # in code block unexpectedly get recognized as markdown titles.

This affect the most when writing bash script snippet in markdown:

# Creating Directory

One can use `mkdir` to create a directory:

```bash
# This create a new directory call `foo` in current directory
mkdir foo
```

The above text snippet contains two lines that start with #:

  • Line 1: a markdown title.
  • Line 6: a bash comment in a code block.

The latter one is not a markdown title, but unexpectedly be recognized as one, as visualize in the following screenshot (highlighted with red arrow):

Screen Shot 2023-05-27 at 22 27 54

To Reproduce

  1. Create a new document.

  2. Set syntax style to Markdown.

  3. Paste the following text:

    ```
    # This should not be tread as a title
    ## Same with two `#`
    ### or more
     # Adding a space before it won't
    ```
    
  4. See error in outline.

Expected behavior

Lines started with # in code block should not be recognized as markdown title.

CotEditor version

4.5.5 (569)

macOS version

macOS Version 12.6.5 (Build 21G531)

Additional context

No response

@IsaacXen IsaacXen added the potential bug issues not yet tested label May 27, 2023
@1024jp 1024jp added request feature requests from users syntax highlight issues related to syntax highlighting and removed potential bug issues not yet tested labels Nov 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
request feature requests from users syntax highlight issues related to syntax highlighting
Development

No branches or pull requests

2 participants