facelessuser / sublime-markdown-popups

Markdown popup dependency for Sublime
https://facelessuser.github.io/sublime-markdown-popups/
Other
112 stars 13 forks source link

magiclinks not always perfect #106

Closed rwols closed 4 years ago

rwols commented 4 years ago

Found a nice example :)

image
facelessuser commented 4 years ago

Do you have some raw text I can run through mdpopups? I can't tell what's being tested from the popup.

Besides bad grammar on my part, if I run a local test of the parser, it works fine:

Screen Shot 2020-10-13 at 1 57 47 PM

I imagine there is some formatting, configuration settings, or something contributing to this.

Here's my default test view that I run through mdpopups_test:

---
allow_code_wrap: false
markdown_extensions:
- markdown.extensions.admonition
- markdown.extensions.attr_list
- markdown.extensions.def_list
-   markdown.extensions.smarty:
        smart_quotes: false
- pymdownx.betterem
-   pymdownx.magiclink:
        repo: sublime-markdown-popups
        repo_url_shortener: true
        user: facelessuser
- pymdownx.extrarawhtml
- pymdownx.keys
-   pymdownx.escapeall:
        hardbreak: true
        nbsp: true
-   pymdownx.smartsymbols:
        ordinal_numbers: false

---

Sublime Text Scheme template.

Converts scheme to CSS provides templating for
additional so that they can access the colors.

Licensed under MIT
Copyright (c) 2015 - 2020 Isaac Muse <isaacmuse@gmail.com>

----------------------

TextMate theme to CSS.

https://manual.macromates.com/en/language_grammars#naming_conventions
facelessuser commented 4 years ago

@gir-bot add S: more-info-needed

facelessuser commented 4 years ago

Even stripping it down to the bare minimum of settings doesn't break it:

---
allow_code_wrap: false
markdown_extensions:
-   pymdownx.magiclink:

---

Sublime Text Scheme template.

Converts scheme to CSS provides templating for
additional so that they can access the colors.

Licensed under MIT
Copyright (c) 2015 - 2020 Isaac Muse <isaacmuse@gmail.com>

----------------------

TextMate theme to CSS.

https://manual.macromates.com/en/language_grammars#naming_conventions

I'll definitely need more info.

rwols commented 4 years ago

The markdown (without the front matter) is

```python\n(module) st_scheme_template\n```\nSublime Text Scheme template.\n\nConverts scheme to CSS provides templating for\nadditional so that they can access the colors.\n\nLicensed under MIT\nCopyright (c) 2015 - 2020 Isaac Muse &lt;isaacmuse@gmail.com&gt;\n\n----------------------\n\nTextMate theme to CSS.\n\nhttps://manual.macromates.com/en/language\\_grammars#naming\\_conventions
rwols commented 4 years ago

Yeah, looks like pyright adds additional backslash escapes to the underscores. Also note that the above is a python string representation of the actual markdown content.

rwols commented 4 years ago

I believe pyright is wrong here. There is no need to escape underscores that do not touch a whitespace char on the left or the right of the underscore.

facelessuser commented 4 years ago

Some markdown implementations will parse _ mid word as emphasis. A lot these days recognize that people like to use snake case and do not enable such functionality by default.

See here: https://johnmacfarlane.net/babelmark2/?text=test_test_test%0A%0Atest*test*test

So, CommonMark and Python Markdown do not parse _ mid word by default. But pyright is maybe over conservative here.

facelessuser commented 4 years ago

Based on the conversation, I think it is safe to say that there is nothing for us to do here. I'm going to resolve this issue.

@gir-bot remove S: triage, S: more-info-needed @gir-bot add S: wontfix