0

问题 - 我正在使用带有超链接和 html 标签的 REST API ( https://developer.yammer.com/docs/messagesjson ) 来获取 yammer 消息,但它无法正确呈现。

  1. 我在 Yammer 上发布了带有超链接的消息。

在 Yammer 上:

在 Yammer 上发布

  1. 我正在使用“REST API(https://developer.yammer.com/docs/messagesjson)”获取消息并在 SharePoint 网站上呈现相同的帖子,但它以不同的格式显示 html 标记和超链接。

现场 :

在网站上发布

  1. “REST API”返回对象中的 Yammer 消息,message.body包含 3 个不同的正文对象(已解析、普通和丰富)
returnValue.body
{urls: Array(2), parsed: " ↵Yammer Post :↵- Here's my best wishes to you on …uck - BeStrong@google.com<https://google.com/> :)", plain: "↵Yammer Post :↵- Here's my best wishes to you on I…uck - BeStrong@google.com<https://google.com/> :)", rich: " <br>Yammer Post :<br>- Here's my best wishes to y…follow noreferrer">https://google.com/</a>&gt; :)"}
parsed: " ↵Yammer Post :↵- Here's my best wishes to you on International Women's Day 2021<https://congratulationsto.com/cards/happy-womens-day-image.jpg>! ↵- Click Here  To check the video↵↵↵Good Luck - BeStrong@google.com<https://google.com/> :)"
plain: "↵Yammer Post :↵- Here's my best wishes to you on International Women's Day 2021<https://congratulationsto.com/cards/happy-womens-day-image.jpg>!↵- Click Here To check the video↵↵Good Luck - BeStrong@google.com<https://google.com/> :)"
rich: " <br>Yammer Post :<br>- Here's my best wishes to you on International Women's Day 2021&lt;<a class="linkified" href="https://congratulationsto.com/cards/happy-womens-day-image.jpg" title="https://congratulationsto.com/cards/happy-womens-day-image.jpg" target="_blank" rel="nofollow noreferrer">https://congratulationsto.com/cards/happy-womens-day-image.j…&lt;/a>&gt;! <br>- Click Here  To check the video<br><br><br>Good Luck - BeStrong@google.com&lt;<a class="linkified" href="https://google.com/" target="_blank" rel="nofollow noreferrer">https://google.com/</a>&gt; :)"
  1. 具有纯 html 文本且没有超链接的已解析和纯对象。所以我使用该message.body.rich对象来获取 Yammer Post,但它没有正确的 html 格式。

当前 Html 格式:

<div class="post-excerpt">
        <p>
            <br>Yammer Post :
            <br>- Here's my best wishes to you on International Women's Day 2021&lt;
                <a class="linkified" href="https://congratulationsto.com/cards/happy-womens-day-image.jpg" title="https://congratulationsto.com/cards/happy-womens-day-image.jpg" target="_blank" rel="nofollow noreferrer">https://congratulationsto.com/cards/happy-womens-day-image.j…&lt;/a>&gt;!
            <br>- Click Here  To check the video<br><br><br>Good Luck - BeStrong@google.com&lt;
                <a class="linkified" href="https://google.com/" target="_blank" rel="nofollow noreferrer">https://google.com/</a>&gt; :)
        </p>
</div>

预期的 HTML 格式:

<div class="post-excerpt">
        <p>Yammer Post :</p>
        <ul>
            <li>
                Here's my best wishes to you on <a href="https://congratulationsto.com/cards/happy-womens-day-image.jpg" title="https://congratulationsto.com/cards/happy-womens-day-image.jpg" rel="nofollow noreferrer" target="_blank">International Women's Day 2021</a>!
            </li>
            <li>
                <a href="https://www.google.com/logos/2021/video_template/iwd/rc2/main_video_low.mp4" title="https://www.google.com/logos/2021/video_template/iwd/rc2/main_video_low.mp4" rel="nofollow noreferrer" target="_blank"><strong>Click</strong> <strong>Here </strong></a><strong> To check the video</strong>
            </li>
        </ul>
        <p>&nbsp;</p>
        <p>&nbsp;</p>
        <p><strong>Good Luck - </strong><a href="https://google.com/" title="https://google.com/" rel="nofollow noreferrer" target="_blank"><strong>BeStrong@google.com</strong></a><strong> :)</strong></p>
</div>

请在这方面帮助我..

谢谢你!!

4

0 回答 0