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

Inline text highlighting #1885

Closed
dclaux opened this issue Sep 11, 2018 · 1 comment
Closed

Inline text highlighting #1885

dclaux opened this issue Sep 11, 2018 · 1 comment

Comments

@dclaux
Copy link
Member

dclaux commented Sep 11, 2018

Problem

Outlook partners are asking for a way to highlight a portion of a TextBlock. There is currently no way to do so.

Proposed solution

Markdown officially allows html tags. We should allow the use of the standard tag in TextBlock. For instance:

{
    "type": "TextBlock",
    "text": "This is <mark>highlighted</mark>"
}

would result in the word "highlighted" being, well, highlighted.

The highlight color would have to be configurable in HostConfig as part of container styles. The associated font color for highlighted text would also have to be configurable (given that the highlight essentially changes the text's background color.) It would look like this:

{
        ...
        containerStyles: {
            default: {
                backgroundColor: "#FFFFFF",
                foregroundColors: {
                        ...
                },
                highlightBackgroundColor: "#0000FF",
                highlightForegroundColor: "#FFFFFF"
            },
            ...
        }
}

Open questions

  • How easy is it to programmatically construct markdown? There doesn't seem to be any libraries for it. Maybe we should use an array of runs instead?

Alt solution

[Andrew Leader] Mimick what XAML does with RichTextBlock...

{
  "type": "RichTextBlock",
  "wrap": 2,
  "paragraphs": [
    {
      "inlines": [
        {
          "type": "TextRun",
          "text": "This is "
        },
        {
          "type": "TextRun",
          "text": "highlighted",
          "highlight": true
        }
      ]
    }
  ]
}

This could also be our solution for inline colors, #1079, and inline advanced emojis #1645, and inline actions #865

@andrewleader
Copy link
Contributor

Closing in favor of the consolidated inline text runs issue: #1933

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants