Skip to content

Support for citation chips #246

@xindixu

Description

@xindixu

First of all, thank you for this amazing library! ❤️

Is your feature request related to a problem? Please describe.
Partially. I'm switching from react-native-markdown-display so that we can have native text selection support on mobile. I'm slightly frustrated that this library doesn't support custom renderers, esp for inline elements (link, mention, etc)

Describe the solution you'd like
Image

Would be great if this library to support citation chips. Something like this:

  1. Show a superscript of the source number
  2. On hover, show a tooltip with any content
  3. On click, it opens the link to the cited site
  4. A way to distinguish different links and their rendering logic. Examples:
    • [some library](https://google.com) → normal link
    • {@}[Casper](de047f59-b2e4-43d7-bf85-786087c98a72) → mentioning users
    • {+}[table.csv](Generated/table.csv) → mentioning files
    • [people.com](https://people.com?citation=1) → citation chips

Nice to have:

  1. Allow users define:
    • how to render the display text
    • how to render the tooltip
    • how to distinguish different links (regex-based)
  2. Users can highlight text around citation chips and mention (i.e. they won't cut the paragraph flow)

Describe alternatives you've considered
I've been manually constructing the citation chips and mention link. I was able to achieve this by:

  1. Manually parsing the markdown content
  2. If the markdown contains citation chips or mentions, I'll use custom rendering logic to compose the block instead of using this library. (ex: mention chip, bolded text, normal text, code, citation)

FYI, I've been applying similar logic to block content like code blocks, tables, latex math. Block content is much easier to deal with, so custom rendering logic works nicely over there.

Example screenshots

Image Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions