Can a .Display() method similar to that in Polyglot Notebooks be added into Verso Notebook? #34
Replies: 3 comments 3 replies
-
|
Thanks for the feature request. Most of the building blocks that would support this are implemented, we'll look at that for an upcoming release. |
Beta Was this translation helpful? Give feedback.
-
|
Can you share a bit more detail about what you're trying to accomplish, include pseudo code snippets if necessary? We may have different ideas in mind, along with the architecture differences with Polyglot and I want to make sure if I support functionality like this it's consistent across the app. |
Beta Was this translation helpful? Give feedback.
-
|
This feature request will be included in the next release. Here's how to use it across the languages: C# The Display() extension method is available on any object during cell execution. It runs the value through the formatter pipeline and renders the output inline, and for example if you register a formatter for your type, Display() will use it automatically. var data = new { Name = "Verso", Version = 1, Features = new[] { "notebooks", "extensions" } };
data.Display();
// With an explicit MIME type
data.Display("application/json");
// Multiple outputs in a single cell
foreach (var item in collection)
{
item.Display("text/html");
}Python Python has a display() function (to matching language conventions) with an optional MIME type hint: cities = {"Tokyo": 13.96, "Delhi": 16.78, "Shanghai": 24.87}
display(cities)
# Explicit MIME type
display(cities, "application/json")
# Works with libraries like pandas/matplotlib
import pandas as pd
df = pd.DataFrame({"City": list(cities.keys()), "Population": list(cities.values())})
display(df) # Renders as an HTML table F# let data = {| Name = "Verso"; Version = 1 |}
display data
// With MIME type
displayAs "application/json" dataJavaScript/TypeScript Uses a display() function: const data = { name: "Verso", version: 1 };
display(data);
// With MIME type
display(data, "application/json");PowerShell PowerShell has a Display function that supports both positional arguments and pipeline input: $data = @{ Name = "Verso"; Version = 1; Features = @("notebooks", "extensions") }
Display $data
# With MIME type
Display $data "application/json"
# Pipeline support
Get-Process | Select-Object -First 5 | DisplayAll languages support the formatter, custom |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Just like this :
docs/formatting.md
docs/display-output-csharp.md
Beta Was this translation helpful? Give feedback.
All reactions