question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Links, 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:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
vlmutolocommented, May 11, 2020

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:

A (B [a: example.com])

would be parsed as

{
    "raw_data": …,
    "value": "A B",
    "spans": [
        {
            "start": 2,
            "end": 3,
            "annotations": [{"type": "a", "val":"example.com"}]
        }
    ]
}

That way, applications can easily ignore the spanned annotations.

1reaction
vlmutolocommented, May 11, 2020

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.

item A has a (link [a: example.com])
item B has regular (text with parentheses)

This is nice because it’s flexible and applies to arbitrary kinds of annotations. Another example:

Calendar
    I have a (doctor’s [name: Dr. Smith]) appointment
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found