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

Introduce MarkupInterpolated and MarkupLineInterpolated extensions #761

Merged
merged 4 commits into from
Mar 22, 2022

Conversation

phil-scott-78
Copy link
Contributor

This supersedes #564 by @0xced. GitHub properly made a mess of his repository and honestly, shame on me for using it.

My penance was documenting the methods as well as introducing an additional method to allow the string interpolation auto-formatting to be used to create a new instance of the Markup widget for using in Table, Tree, etc.

0xced and others added 4 commits March 1, 2022 14:53
These new methods enable easily writing markup with a nice and intuitive syntax without having to worry about escaping the markup.

```csharp
string input = args[0];
string output = Process(input);
AnsiConsole.MarkupLineInterpolated($"[blue]{input}[/] -> [green]{output}[/]");

```

The `Interpolated` suffix was inspired by the Entity Framework Core [FromSqlInterpolated][1] method.

[1]: https://docs.microsoft.com/en-us/ef/core/querying/raw-sql#passing-parameters
Allows automatic handling of interpolated strings to be used on the Markup widget. This would be helpful for people working with Tables and the Tree control who would not be using the MarkupInterpolated methods.
Copy link
Contributor

@nils-a nils-a left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nils-a nils-a merged commit 1d8154f into spectreconsole:main Mar 22, 2022
@nils-a nils-a added this to the 0.44 milestone Mar 22, 2022
@nils-a
Copy link
Contributor

nils-a commented Mar 22, 2022

@0xced your changes have been merged, thanks for your contribution 👍

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

Successfully merging this pull request may close these issues.

None yet

3 participants