Picture of Stimpson Cat
Rich text and semantic markup in adapt-contrib-text component
by Stimpson Cat - Monday, 31 August 2015, 3:26 AM
 

Hi all,

I'm wondering what the status is for rich and semantic markup for text content in the adapt-contrib-text component?

I'm wanting to add emphasis to some words, include an unordered list, and include a hyperlink. Is it best practice to use HTML in the JSON string? i.e:

{
    "_id": "co1-a1-b1-c1",
    "_parentId": "co1-a1-b1",
    "_type": "component",
    "_component": "text",
    "_classes": "",
    "_layout": "left",
    "title": "co1-a1-b1-c1",
    "displayTitle": "",
    "body": "<p>Text with <em>emphasis</em>.</p><p>An unordered list:</p><ul><li>Item 1</li><li>Item 2</li><li>Item 3</li></ul><p>A <a href=\"http://https://community.adaptlearning.org\" target=\"_blank\">hyperlink</a>.",
    "_pageLevelProgress": {
        "_isEnabled": true
    }
},

Picture of Oliver Foster
Re: Rich text and semantic markup in adapt-contrib-text component
by Oliver Foster - Tuesday, 1 September 2015, 8:12 AM
 

Adding html in this way is currently the only option for doing this kind of extra stuff. It can be a bit temperamental using accessibility and extra markup together, but for the most part it'll work perfectly.

 The single quote also works well if escaping the doubles is getting annoying.

 

And make sure your tags have proper endings. That p tag is missing the closing /.

Ollie.

Picture of Stimpson Cat
Re: Rich text and semantic markup in adapt-contrib-text component
by Stimpson Cat - Tuesday, 15 September 2015, 4:30 AM
 

Thanks for your reply Ollie. Much appreciated.