I’m trying to render a personal object set in the Ontology layer called “docs” within Workshop. Each object has the following properties: id, title, and content, where content contains HTML code.
I’ve tried using the “Object list” widget, which provides a nice card UI, but it displays the raw HTML content. I also considered converting the content to Markdown and using the “Markdown” widget, but that would mean losing the card-style layout provided by the Object list.
What’s the best way to render HTML content while retaining the card UI of the Object list? I’d appreciate any suggestions.
At a high level, I’d recommend creating a minimal Slate app that takes in the HTML content and displays it in an HTML widget. You can then embed this app in a dedicated Workshop module using the iFrame Custom Widget set up to display one instance of whatever object has the HTML property. Finally in your main app, rather than using the List widget, you can use the Loop layout to loop through mini object view module and show the HTML for each one.
@lrhyne Great, thanks for your response. Just to confirm what you are saying, you don’t think there is way to do this using existing pre-built widgets in Workshop? I also want to use a custom function I made called ‘get_search_results’ that returns a specific list of objects. Would my function logic be in added into Slate or Workshop?
My understanding of what I need to do is
Create a HTML widget in Slate
Put the HTML widget in a custom iframe
Use the loop layout to render my HTML widget. I don’t see a widget that is called “loop layout”. Could you explain more how I loop over my widgets to display them?
@jenny you can create a loop layout and use that to render each document object with Markdown.
The loop layouts are basically ‘mini Workshop apps’ created from an object set. You design one, and it will spawn a number of these, based on the objects you have in your set.
You can use this to replicate the card layout, by working with the background colours and padding. This could solve your problem, if you are OK with the Markdown rendering.
I suggest the above, as I have yet to see an example of a Slate implementation, that is good.
Alternatively, you could look into this solution, though it is much more complex: https://community.palantir.com/t/how-to-create-a-custom-widget-for-workshop/2182
One call out here the iframe will have performance ramifications. A few other work arounds are:
Create a custom widget using the OSDK. Slightly more performant, but requires some lift
Depending on what tags are used in your HTML content, I have had success converting it into markdown in a pipeline and then using the workshop markdown widget to render it.