To support both quote blocks and code blocks in the Asana product, the HTML tags <blockquote> and <pre> have been added to all Asana objects that interact with rich text!
Developers now have more powerful rich text functionality, being able to mark quoted text and large chunks of code.
Who is affected
All consumers of Asana objects that support rich text (i.e., surface areas that expose html_notes, html_text, and html_description) will be able to read and write the tags <blockquote> and <pre>
While no existing data are altered by this change, consumers should be prepared to handle these new HTML tags in their systems.
Timeline
We are launching this functionality today!
Usage
Both read and write endpoints for rich text will remain the same. That is, endpoints now support <blockquote> and <pre> tags in both requests and responses.
Example
Here is a sample task with both a code block and a quote block in its description:
{
"data": {
"gid": "<task_gid>",
"html_notes": "<body><pre>function myFunction() {\n console.log("This is a code block");\n}</pre>\n<blockquote>This is a quote block</blockquote>\n</body>"
}
}
Migration steps
Ensure that the systems that read and parse rich text are able to handle the tags <blockquote> and <pre>. These are HTML tags that are widely supported in browsers.
This syntax that works on GitHub is very convenient. The way the interaction works now in the editor could support this by just auto-detecting the first line if it’s a supported language. Some editors have a dropdown to select the language, which could work with this as well, but the convention to type it out or detect from pastes is much easier than point and click once you know.
Ah, OK - you’'re in the Developers/API forum section so I assumed…
Those are HTML tags, you can’t type them into the UI; they have to be added into the HTML source of the html_notes field (that’s the API field name for the UI Description field) via the API.
In terms of the UI, the code block is already there now (just recently added):
Quote block isn’t there yet but I imagine they’ll probably be adding it since the underlying platform now supports it.
Yes, the UI is what I was referring to. Especially given the screenshots, it looked like the “Code” button (which currently just applies ugly styles) was made to work for blocks of code. I hope you are right that this represents a step in the right direction, and that the UI will follow shortly!