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

Disable hashtag in link text #167

Open
srid opened this issue Oct 6, 2021 · 4 comments
Open

Disable hashtag in link text #167

srid opened this issue Oct 6, 2021 · 4 comments
Labels
help wanted Extra attention is needed plutonomicon
Milestone

Comments

@srid
Copy link
Owner

srid commented Oct 6, 2021

I notice my tags list is flooded with tags of the form #[\d+], coming from the titles of issue tracker links. Looking at the source I see the hashTagSpec follows CommonMark's allowing other inline elements in link titles, ie ital bold #hash. Still, in the case of hashtags my gut says they should be disallowed in the titles of other links (mostly because I want to be able to drop links from the browser without sanitizing the titles), also Obsidian doesn't parse them. WDYT?

Originally posted by @edrex in #166

@srid srid added the good first issue Good for newcomers label Oct 6, 2021
@srid srid added this to the 1.0 milestone Oct 6, 2021
@edrex
Copy link
Contributor

edrex commented Oct 7, 2021

Reading WikiLink.hs, I see that wiki links are also parsed in markdown link text. BracketedSpec disallows nesting links in the link text, but I'm not sufficiently familiar with Haskell or parsers to clearly see how to similarly disallow nesting WikiLinks and HashTags

@srid srid added the help wanted Extra attention is needed label Oct 11, 2021
srid added a commit to Plutonomicon/plutarch-plutus that referenced this issue Mar 25, 2022
@srid
Copy link
Owner Author

srid commented Jun 18, 2022

FTR, using \ will disable parsing of that inline tag, eg: \#foo. See the commit above.

Obviously, the ideal way is to have a way to control this globally so that these \ are not required.

@RoyiAvital
Copy link

RoyiAvital commented Jun 18, 2022

Maybe add a logic which parse #SomeText in the following cases:

  1. It is a beginning of a new row.
  2. No space between # and the text.
  3. No text after the adjacent text unless it is another # (Support list of tags).

If we want to follow Obsidian Tags then no spaces in the tags as well and a tag can not be composed of digits only.

@srid srid modified the milestones: 0.8, 1.0 Aug 21, 2022
@kukimik
Copy link
Contributor

kukimik commented Jun 20, 2023

Reading WikiLink.hs, I see that wiki links are also parsed in markdown link text.

Related: #349

Note that the embedding wikilinks (at least those that embed images) should be parsed in the link text.


I tried implementing an workaround using a Pandoc filter that converts the tag Spans nested in link descriptions to their Inlines contents, but , but run into some obstacles, like handling of:

[see *issue #12345* on github](https://github.com/srid/emanote/12345)

The problem is that the second * is parsed as part of the hashtag.

Another nasty example:

[#abc{.someclass}](def)

On the other hand, as far as I understand, the discussion in jgm/commonmark-hs#97 implies that this may be difficult to handle during parsing using commonmark-hs. Perhaps switching to Pandoc parser #264 is the way to go?


I don't think the "good first issue" tag is appropriate.

@srid srid removed the good first issue Good for newcomers label Jun 20, 2023
kukimik added a commit to kukimik/TristanCacqueray.github.io that referenced this issue Nov 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed plutonomicon
Projects
None yet
Development

No branches or pull requests

4 participants