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

#hashtag is rendered as a <h1>. It should require a space. #572

Closed
meta-meta opened this issue Nov 18, 2019 · 5 comments · Fixed by #607
Closed

#hashtag is rendered as a <h1>. It should require a space. #572

meta-meta opened this issue Nov 18, 2019 · 5 comments · Fixed by #607
Labels
C: syntax Category: syntax definition

Comments

@meta-meta
Copy link

meta-meta commented Nov 18, 2019

I am using #hashtags in my notes as I run them through a script to organize them. I also write them in markdown but when building using MarkdownEdit, #hashtag turns into into <h1>hashtag</h1>.

See this related issue for markedjs: markedjs/marked#201
and https://daringfireball.net/projects/markdown/syntax#header

flexo333 added a commit to flexo333/MarkdownEditing that referenced this issue Feb 20, 2021
Improves title check to look for a trailing space. This avoids marking #hashtags as titles. As per SublimeText-Markdown#572
flexo333 added a commit to flexo333/MarkdownEditing that referenced this issue Feb 20, 2021
@deathaxe
Copy link
Member

MarkdownEditing doesn't provide a build script. Maybe you are using MarkdownPreview?

@meta-meta
Copy link
Author

MarkdownEditing doesn't provide a build script. Maybe you are using MarkdownPreview?

Oh, you're totally right. And it looks like the formatting is now fixed in MarkdownEditing's syntax highlighting (it does that at least, right?) It's also resolved in MarkdownPreview.

@meta-meta
Copy link
Author

Hmm, actually I take that back, it's still trying to parse it as a header. The # is grey on the first tag of a line. These are underlined as well. I'm not sure what that means.
image

Markdown lint:

line 3: MD018 - No space after hash on atx style header, no space
line 3: MD025 - Multiple top level headers in the same document, 2 found

@meta-meta meta-meta reopened this May 14, 2021
@meta-meta
Copy link
Author

And for posterity, now that I understand that these are separate packages, MarkdownPreview renders <h1 id="tag-taggy-taggy2">tag #taggy #taggy2<a class="headerlink" href="#tag-taggy-taggy2" title="Permanent link"></a></h1> when using vanilla markdown, which is totally off the wall IMO.

When using github or gitlab flavors, I get a result that looks more correct <p>#tag #taggy #taggy2</p>

@deathaxe
Copy link
Member

My hunch is that the "required space" is something which was added "recently". ST's default syntax renders headers without space, too. The syntax definition of this package is IMHO even more out of date and breaks with dozens of markdown details.

Fixing all those syntax bugs is somewhat larger task. My goal is to try to improve ST's core syntax and extend it via this package to add more fenced code blocks, but this will take a while and will be compatible with ST4 only.

deathaxe added a commit that referenced this issue May 14, 2021
Fixes #572

Headings must start with a hashtag followed by at least one space.
They may be indented by up to three whitespace.

This commit fixes the syntax definitions to follow this rule.
@deathaxe deathaxe mentioned this issue May 14, 2021
@deathaxe deathaxe added bug C: syntax Category: syntax definition and removed invalid labels May 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: syntax Category: syntax definition
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants