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

Hyperlink datatype #1206

Open
JosephBond opened this issue Dec 20, 2024 · 1 comment
Open

Hyperlink datatype #1206

JosephBond opened this issue Dec 20, 2024 · 1 comment

Comments

@JosephBond
Copy link
Collaborator

JosephBond commented Dec 20, 2024

We need to include a new datatype, for now we will call it Hyperlink, which packages up a value with a string that references or “explains” it. We need to be able to splice these hyperlink values into a LinkedText, so that rather than a list of strings, a LinkedText will instead be a list of String + Hyperlink (perhaps wrapped in a newtype). Since we need a way of distinguishing an inert string from a Hyperlink, we will wrap the inert strings in their own constructor. Since this will likely get clunky, we may soon want to push on #1187 to streamline things for document authors.

Since these strings can themselves be “computed” (the use-case we have investigated so far), interacting with the text once it’s rendered should modify selection information on the (potentially computed, potentially inert) string, and the value to which it makes reference

Related Issues

@JosephBond JosephBond added this to the fluid 0.7.next milestone Dec 20, 2024
@JosephBond JosephBond added this to Fluid Dec 20, 2024
@JosephBond JosephBond moved this to Planned in Fluid Dec 20, 2024
@rolyp
Copy link
Collaborator

rolyp commented Dec 20, 2024

Suggestions for now:

  • Rename LinkedText to Paragraph, which takes a list of TextFragment
  • New TextFragment datatype with two constructors:
    • Link (with two arguments)
    • Text (with one)
  • Remove Explanation experiment

Other partially-formed thoughts:

  • Is the “very likely” pattern better thought of as an example of Link where there is both a computed value (e.g. proportion of distribution that is above 2°C) and some computed text (mapping that value to the string “very likely”)? It might be preferable to think of this as a Link rather than Text because one could easily imagine wanting to be able to reveal the underlying value in the UI. (Although that behaviour would in some sense be redundant if we could visualise the computational explanation behind a value, e.g. a Text element.)
  • Should a Link be a value paired with a function which will interpret that value as a string? Then Text (numToStr n) could be expressed as Link n numToStr and in fact Text e would be equivalent to Link e id.

@rolyp rolyp changed the title Hyperlink datatype Hyperlink datatype Dec 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Planned
Development

No branches or pull requests

2 participants