问题
Asana added rich text formatting in June 2014 (https://blog.asana.com/2014/06/rich-text/)
How do you get the formatting metadata from the Asana API?
For example, if I fill in a task description with:
some bold text. some italic text
a list
- foo
- bar
- sublist
- a
- b
- c
- baz
The API returns the following for the note field, which excludes any formatting info:
"notes":"some bold text. some italic text\n\na list\n\nfoo\n\nbar\n\nsublist \na\nb\nc\nbaz"
回答1:
We do not currently support rich text formatting via the API. However if you're feeling adventurous, we are currently working on this support, and you can try it out by using html_notes (for tasks) and html_text (for stories). You can request them using ?opt_fields=html_notes
, for example.
Note however that this is still very experimental/early support. If the parser doesn't like the HTML you post, it just strips everything back to plaintext. So this is really only if you're feeling particularly adventurous - otherwise, I'd wait until we release full-fledged public support for it, with documentation and everything.
回答2:
Is this still something "experimental"? I didn't want to post an answer but it won't let me comment the existing answer. So far I have found:
Acceptable
<b>
<ul>
<li>
Not acceptable:
<h4>
<p>
<div>
<section>
<br>
Any other suggestions for something to do a linebreak? Back in the day, I was using Wufoo to directly create tasks in Asana and it formatted it with a bold heading and then regular text for each entry data. I am trying to achieve this on my own without going that route because I am also updating a database when I receive the form submission. Any ideas on how to format (only the most basic of formatting)?
来源:https://stackoverflow.com/questions/26302248/how-to-get-rich-text-formatting-from-asana-task-api