apple-tvtvml

TVML: adding new lines to a description text


Experimenting with Apple TV's TVML: I'm using a Product Template, and in the description field I'd like to add carriage returns, to make it look somewhat like a list.

Here is a simple example:

var Template = function() { return `<?xml version="1.0" encoding="UTF-8" ?>
    <document>
        <productTemplate>
            <banner>
                <infoList>
                </infoList>
                <stack>
                    <title>Big Title</title>
                    <description>
                        Line one
                        Line two
                    </description>
                </stack>
            </banner>
        </productTemplate>
    </document>`
}

I've tried \n, &#xD, &#xA between the lines, and even something like this:

<![CDATA[
  Line 1 <br />
  Line 2 <br />
]]>

But none of these work. Is there a way to incorporate line breaks in TVML descriptions?


Solution

  • Having this code in a template.xml.js and loading it via the Presenter.js in the TVMLCatalog example from apple:

    <stack>
        <description>Insert your \n username (tipically your ID)</description>
    </stack>
    

    It renders

    enter image description here