Formatting text in a table

Is it possible to apply formatting to text in a table? Thinking font size, weight, bold/italic and text colour.

Yep. Take a look at this script:

https://talk.automators.fm/t/london-tube-status/2454/6

I think that link is to my London Tube status script - there’s no text formatting in there

My mistake, I saw colors In the table and got all excited.

Probably have to resort to an html table?

You can do an html table?!

(I really need to look through the documentation…)

Well, you can in JavaScript. Not sure about Scriptable?

But if you build an html table and pass it to quicklook? That’s where I’d start, but then again html is my goto when bash scripting fails me, so … bias? :joy::rofl:

You can load raw HTML in a web view.

e.g.

WebView.loadHTML("<strong>foo</strong> bar");

This can be presented on a Scriptable panel when called via Siri or full screen when not.

1 Like

Great, thanks. Looks like I have some more work to do then. Massive inline styles and scripts coming up…

Think this works as a template for html with string substitutions, respecting the screen width (and providing those pesky back-ticks when you’re typing on an iOS keyboard)

let headContent = `
  <meta name="viewport" content="initial-scale=1.0">
`

let bodyContent = `
  <h1>header</h1>
  <p>paragraph</p>
`

let myHTML = `
<html>
  <head>
    ${headContent}
  </head>
  <body>
    ${bodyContent}
  </body>
</html>
`

WebView.loadHTML(myHTML)