Improving accessibility of the fonts with a pack?

Is there a way to be able to use style attributes in packs to style the text? I want to improve accessibility of the pages by allowing users to set a font-size preference and wrote a pack to do it but the style attributes seem to get stripped by the HTML sanitizer.

  name: "FormatFontSize",
  description: "Formats to a custom font size",
  parameters: [
      type: coda.ParameterType.String,
      name: "text",
      description: "The text to format to font size",
      type: coda.ParameterType.String,
      name: "size",
      description: "The font size",
  resultType: coda.ValueType.String,
  codaType: coda.ValueHintType.Html,
  execute: async function ([text, size]) {
    return `<div style="color:blue;font-size:${size};">${text}</div>`
1 Like

Hi @gryorff - Welcome to the Coda Community! Unfortunately you can’t set the font size or color using a Pack in this way. In the docs we mention:

Code only supports a small subset of HTML markup, limited to the basic formatting you can accomplish in markdown.

See Return data with meaningful types - Coda Pack SDK

In practice this means you can only use basic HTML markup like bold, italic, etc. Colors, font-size, and other formatting not available in markdown isn’t going to work with HTML.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.