# \[New\] Code and quote blocks in rich text

**URL:** <https://forum.asana.com/t/new-code-and-quote-blocks-in-rich-text/927099>\
**Category:** Changelog\
**Tags:** stories-api, tasks-api, projects-api, teams-api\
**Created:** [23 September 2024 22:36 UTC](https://forum.asana.com/t/new-code-and-quote-blocks-in-rich-text/927099 "2024-09-23T22:36:59Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andrew-asana](https://luna1.co/8d76cd.png) [@Andrew-asana](https://forum.asana.com/u/Andrew-asana)\
**Post date:** [23 September 2024 22:36 UTC](https://forum.asana.com/t/new-code-and-quote-blocks-in-rich-text/927099/1 "2024-09-23T22:36:59Z")

</div>

## Summary

- 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](https://developers.asana.com/docs/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](https://developers.asana.com/docs/rich-text#supported-objects) (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:

 ![Screenshot 2024-09-23 at 2.36.17 PM](https://us1.discourse-cdn.com/asana/original/4X/1/b/5/1b59a5bc28620d8f2c913686da22c2b48273df1c.png)

If we make a [GET /tasks/{task\_gid}](https://developers.asana.com/reference/gettask) request for this particular task, using `html_notes` as an [opt\_field](https://developers.asana.com/docs/inputoutput-options):

```raw
curl --request GET \
     --url 'https://app.asana.com/api/1.0/tasks/<task_gid>?opt_fields=html_notes' \
     --header 'accept: application/json' \
     --header 'authorization: Bearer <personal_access_token>'

```

We see the following response:

```raw
{
  "data": {
    "gid": "<task_gid>",
    "html_notes": "<body><pre>function myFunction() {\n console.log(&quot;This is a code block&quot;);\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.

## Resources

- [MDN documentation on blockquote](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/blockquote)
- [MDN documentation on pre](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/pre)

---

<div class="post-metadata">

**Author:** ![Jon\_Wu](https://luna1.co/8d76cd.png) [@Jon\_Wu](https://forum.asana.com/u/Jon_Wu)\
**Post date:** [26 September 2024 17:18 UTC](https://forum.asana.com/t/new-code-and-quote-blocks-in-rich-text/927099/2 "2024-09-26T17:18:03Z")

</div>

Very exciting! It was so hard to deal with multi-line code blocks before so this will be a big help.

Are you considering allowing code highlighting in the future, or is that too dev-centric to make it into the product?

For example:

````auto
```javascript
console.log('Hello world')
``` (end)

````

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.

---

<div class="post-metadata">

**Author:** ![Mike\_Dickey](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/mike_dickey/32/83295_2.png) [@Mike\_Dickey](https://forum.asana.com/u/Mike_Dickey)\
**Post date:** [1 October 2024 17:10 UTC](https://forum.asana.com/t/new-code-and-quote-blocks-in-rich-text/927099/3 "2024-10-01T17:10:15Z")

</div>

This sounded very exciting since it’s something many users have long wanted to have. Unfortunately, it does not seem to work for me ☹

![pre_in_comments](https://us1.discourse-cdn.com/asana/original/4X/5/6/9/569c1d9402a0bb1d310e03d5a167134842a2955f.png)

---

<div class="post-metadata">

**Author:** ![Mike\_Dickey](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/mike_dickey/32/83295_2.png) [@Mike\_Dickey](https://forum.asana.com/u/Mike_Dickey)\
**Post date:** [1 October 2024 17:11 UTC](https://forum.asana.com/t/new-code-and-quote-blocks-in-rich-text/927099/4 "2024-10-01T17:11:06Z")

</div>

![pre_in_task_description](https://us1.discourse-cdn.com/asana/original/4X/c/8/0/c80f9fe0e9d8a3cff555c09a27c796bef0f0e822.png)

---

<div class="post-metadata">

**Author:** ![Phil\_Seeman](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/phil_seeman/32/81525_2.png) [@Phil\_Seeman](https://forum.asana.com/u/Phil_Seeman)\
**Post date:** [1 October 2024 18:03 UTC](https://forum.asana.com/t/new-code-and-quote-blocks-in-rich-text/927099/5 "2024-10-01T18:03:22Z")

</div>

Hi @Mike_Dickey,

Can you post your code that created this, especially the complete `html_text` string that you’re sending to Asana?

---

<div class="post-metadata">

**Author:** ![Mike\_Dickey](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/mike_dickey/32/83295_2.png) [@Mike\_Dickey](https://forum.asana.com/u/Mike_Dickey)\
**Post date:** [1 October 2024 19:14 UTC](https://forum.asana.com/t/new-code-and-quote-blocks-in-rich-text/927099/6 "2024-10-01T19:14:34Z")

</div>

Hi Phil, I’m just typing it into Asana’s web interface.

---

<div class="post-metadata">

**Author:** ![Andrew\_Burch](https://luna1.co/8d76cd.png) [@Andrew\_Burch](https://forum.asana.com/u/Andrew_Burch)\
**Post date:** [1 October 2024 19:44 UTC](https://forum.asana.com/t/new-code-and-quote-blocks-in-rich-text/927099/7 "2024-10-01T19:44:24Z")

</div>

Happy to see this! Please include a ‘COPY’ button in a future release.

---

<div class="post-metadata">

**Author:** ![Phil\_Seeman](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/phil_seeman/32/81525_2.png) [@Phil\_Seeman](https://forum.asana.com/u/Phil_Seeman)\
**Post date:** [2 October 2024 01:24 UTC](https://forum.asana.com/t/new-code-and-quote-blocks-in-rich-text/927099/8 "2024-10-02T01:24:06Z")

</div>

> [@Mike\_Dickey](#):
>
> I’m just typing it into Asana’s web interface.

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):

![image](https://us1.discourse-cdn.com/asana/original/4X/1/f/4/1f4ccfb37eceb3f22df693a612afdda34ff912c2.png)

Quote block isn’t there yet but I imagine they’ll probably be adding it since the underlying platform now supports it.

---

<div class="post-metadata">

**Author:** ![Mike\_Dickey](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/mike_dickey/32/83295_2.png) [@Mike\_Dickey](https://forum.asana.com/u/Mike_Dickey)\
**Post date:** [2 October 2024 16:04 UTC](https://forum.asana.com/t/new-code-and-quote-blocks-in-rich-text/927099/9 "2024-10-02T16:04:13Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![Wouter\_van\_Heijst](https://luna1.co/8d76cd.png) [@Wouter\_van\_Heijst](https://forum.asana.com/u/Wouter_van_Heijst)\
**Post date:** [7 October 2024 11:20 UTC](https://forum.asana.com/t/new-code-and-quote-blocks-in-rich-text/927099/10 "2024-10-07T11:20:22Z")

</div>

Why (more) rich text and not just Markdown?
