Links/anchors
See original GitHub issueLinks, being an essential part of hypermedia, ought to be first-class citizens in Margin. I can see a few ways of doing this:
Markdown-compatible (would require modifying parser, but less friction for md users):
[example.com](my example)
Quasi-HTML (works with parser, harder to “wrap” text to make it a link)
[a:example.com]
My vote is for the former. Basically, simple []
is treated as an annotation, while the []()
pattern is treated as a link.
I found this cool thing called [Margin](github.com/gamburg/margin)
would parse as
{
"raw_data": " I found this cool thing called [Margin](github.com/gamburg/margin)",
"value": "I found this cool thing called Margin",
"annotations": {},
"links": [
{"ref": "github.com/gamburg/margin", "value": "Margin"}
],
"children": []
}
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:5 (2 by maintainers)
Top Results From Across the Web
HTML Anchors: Here's How To Create Links For Fast ...
HTML Anchors: Here's How To Create Links For Fast Navigation ... The anchor element is used to create hyperlinks between a source anchor...
Read more >How to Add an Anchor Link to Jump to a Specific Part of a Page
An anchor link is a link, which allows the users to flow through a website page. It helps to scroll and skim-read easily....
Read more >HTML anchor link - RapidTables.com
HTML anchor link code. How to link in the same page in HTML.
Read more >Link Within a Page - HTML Tutorial - EchoEcho.Com
Linking to anchors is very similar to normal links. Normal links always point to the top of a page. Anchors point to a...
Read more >How to Use HTML Anchors to Improve UX - SEMrush
You can also use the anchor tag to create anchor links. Anchor links (or “jump” links) link to different sections of the same...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Another thought: the parser should probably return regular text for these types of annotations (spanned annotations? restricted? partial? idk what the right name is). And it should also return another field with a list of “spans” and annotations for those spans. The spans should probably be utf8 byte ranges. Not sure how well JS supports that, though.
Example:
would be parsed as
That way, applications can easily ignore the spanned annotations.
I think there’s a lot of value to keeping Margin small and simple. The annotations syntax is really powerful. Adding a special case for links seems a bit cluttered when
[a: example.com]
works so well.It seems like the real issue is that there’s no way to attach annotations to only part of an item. Maybe the syntax for that could look like a variant of Markdown’s links.
This is nice because it’s flexible and applies to arbitrary kinds of annotations. Another example: