本文介绍了我可以发送HTML标签吗?例如< b>或< strong>在POST请求中,让我的文本一旦到达Asana就会变成粗体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用POST HTTP请求创建任务,工作正常,我的任务正在Asana上创建。
这是我要发送的任务的示例

  var task = {
data:{
受让人:我,
工作空间:1234567,
项目:9876543,
父:空,
备注:`全名:$ {myData .fullName}
名字:$ {myData.firstName}
城市:$ {myData.city}`
}
}

一旦在Asana中创建了我的任务,我希望这些注释能够像这样显示,其中一部分字符串是粗体的:



全名:John Doe



名字:John



城市:旧金山



我的失败尝试如下所示:

  var task = {
data:{
受让人:me,
工作区:1234567,
项目:9876543,
父项:null,
注释:`< b>全名:< / b> $ {myData.fullName}
< b>名字:< / b> $ {myData.firstName}
< b>城市:< / b> $ {myData.city}`
}
}

作为Asana笔记的结果:

 < b>全名< / b> John Doe 

< b>名字:< / b> John

< b>城市:< / b>旧金山


解决方案

您需要对请求进行两项更改为了得到你想要的文本格式:


  1. 使用 html_notes 代替注释注释字段被视为文字,这就是为什么您在Asana中看到原始HTML而不是粗体文本的原因。

  2. 使用< strong> 标记替代< b> 以粗体显示文本。


I'm creating a Task using a POST HTTP request, it's working fine and my task is being created on Asana.here's an example of the task I'm sending

var task = {
  data: {
    assignee: "me",
    workspace: "1234567", 
    projects: "9876543",
    parent: null,
    notes:`Full Name: ${myData.fullName}
           First Name: ${myData.firstName}
           City: ${myData.city}`
  }
 }

Once my task gets created in Asana, I would like the notes to be displayed like this, with part of the string bold:

Full Name: John Doe

First Name: John

City: San Francisco

My unsuccessful attempt was like this:

var task = {
  data: {
    assignee: "me",
    workspace: "1234567", 
    projects: "9876543",
    parent: null,
    notes:`<b>Full Name:</b> ${myData.fullName}
           <b>First Name:</b> ${myData.firstName}
           <b>City:</b> ${myData.city}`
  }
}

And I ended up getting this as a result as a note in Asana:

<b>Full Name</b> John Doe

<b>First Name:</b> John

<b>City:</b> San Francisco
解决方案

You need to make two changes in your request in order to get your desired text formatting:

  1. Use html_notes instead of notes. The notes field is treated as a literal, which is why you are seeing raw HTML instead of bolded text in Asana.
  2. Use the <strong> tag instead of <b> to bold the text.

这篇关于我可以发送HTML标签吗?例如&lt; b&gt;或&lt; strong&gt;在POST请求中,让我的文本一旦到达Asana就会变成粗体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 17:33