charmbracelet / glamour

Stylesheet-based markdown rendering for your CLI apps 💇🏻‍♀️

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wrong rendering assumption when using `@` in markdown files

marcelarie opened this issue · comments

commented

glow version 1.5.0

I found a difference between bat and glow, and I think that bat has the correct output on this one. Seems that glow assumes that any two strings separated by a @ are a mail address.

Here is an example of the bat output:
Screenshot 2023-02-24 at 23 58 31

Here is an example of the glow output:
Screenshot 2023-02-24 at 23 58 41

You can see how the mailto: link is generated.

This is the content of the file:

npm packages:
    apk-mitm@1.1.0 axios@0.23.0 dockerfile-language-server-nodejs@0.7.2 intelephense@1.7.1 jimp@0.16.1 markdown-pdf@10.0.0 neovim@4.10.1 npm@8.3.0 opencv-wasm@4.3.0-10 pixelmatch@5.2.1 puppeteer-extra-plugin-stealth@2.9.0 puppeteer-extra-plugin-user-data-dir@2.3.1 puppeteer-extra-plugin-user-preferences@2.3.1 puppeteer-extra-plugin@3.2.0 puppeteer-extra@3.2.3 puppeteer@13.0.1 typescript-language-server@0.6.4 typescript@4.4.4 vim-language-server@2.2.5 vscode-langservers-extracted@3.0.1 xvfb@0.4.0 yaml-language-server@1.0.0

pip packages:
     mdformat-gfm


fix firefox resize on TWM:
go to `about:config` and change `privacy.resistFingerprinting` to `true`;

@marcelarie Good catch! Thank you for reporting this. I'm going to move this over to Glamour, the markdown rendering library that handles the markdown rendering under the hood in Glow. I'll be sure to bring it to the attention of the team.

commented

Cool, thanks!

FWIW: one workaround (for now) would be to put it inside a codeblock

I looked into this; it seems to be consistent with other markdown renderers. It's our upstream dependency goldmark that's autolinking email addresses if it matches the HTML5 regex in the CommonMark Spec.

I wrote some tests to reproduce the behaviour you're experiencing in Goldmark. Based on their note in their issue template, I don't think they're going to change how they're handling emails. We might consider how we want to handle the type we get back from the autolinking... I'll discuss with the team to see what they think :)