<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Arcade expressions for hyperlinked popup text do not honor native text formatting in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expressions-for-hyperlinked-popup-text-do/m-p/1351697#M55989</link>
    <description>&lt;P&gt;I don't see any way to do that within the Arcade element, since it strips out the formatting from your text. The only way I can come up with is to use the regular Text element for your text and add the Arcade element for the url. But you'd have to do that for each pair of fields.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 20 Nov 2023 21:14:59 GMT</pubDate>
    <dc:creator>KenBuja</dc:creator>
    <dc:date>2023-11-20T21:14:59Z</dc:date>
    <item>
      <title>Arcade expressions for hyperlinked popup text do not honor native text formatting</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expressions-for-hyperlinked-popup-text-do/m-p/1351667#M55985</link>
      <description>&lt;P&gt;I have columns in a feature layer, some of which are designated to operate as text in the features' popups, while others provide links to which those text items are hyperlinked. each popup item has 2 columns: text and links. The original text has formatting embedded in the feature layer and is displayed nicely when simply referenced in the text popup editor:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JACooper_0-1700510333585.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/86602i8533C91D33372473/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JACooper_0-1700510333585.png" alt="JACooper_0-1700510333585.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;However, &lt;A href="https://community.esri.com/t5/arcgis-online-questions/return-html-with-arcade-in-pop-up/m-p/1284435/highlight/true#M51832" target="_self"&gt;as described elsewhere&lt;/A&gt;, the use of the Arcade element allows for hyperlinking, which is what I want. The code below is working well and generating dynamic hyperlinks to the links stored in my attribute table. However, the nice formatting that was originally associated with the text is lost. Everything is cramped into one line and now looks like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JACooper_1-1700510539734.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/86603iAC5E152CED82365A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JACooper_1-1700510539734.png" alt="JACooper_1-1700510539734.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I want a solution that both looks nice and links how I want.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/2839"&gt;@KenBuja&lt;/a&gt;, you have had some excellent answers on other Arcade popup questions here. Any thoughts? Perhaps there is a `return{}` specification that can preserve the formatting I want to keep?&lt;/P&gt;&lt;H2&gt;Code:&lt;/H2&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// Truncated version of full code. `json_labdict ` &amp;amp; `displayText` are not comprehensive for brevity.
var json_labdict = '{"stabilization_grants_summary_popup": "Stabilization Grants Summary", "State_and_Local_Fiscal_Recovery_Funds_popup": "Use of State and Local Fiscal Recovery Funding", "2021_state_legislation_popup": "State Legislative Highlights 2021"}'

var arcade_labdict = Dictionary(json_labdict)

var displayText = `

${when(IsEmpty($feature["stabilization_grants_summary_po"]), null, `&amp;lt;p&amp;gt;&amp;lt;b&amp;gt;${arcade_labdict["stabilization_grants_summary_popup"]}&amp;lt;/b&amp;gt;: &amp;lt;a href=${$feature["stabilization_grants_summary_li"]}&amp;gt;${$feature["stabilization_grants_summary_po"]}&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;`)}

${when(IsEmpty($feature["State_and_Local_Fiscal_Recovery"]), null, `&amp;lt;p&amp;gt;&amp;lt;b&amp;gt;${arcade_labdict["State_and_Local_Fiscal_Recovery_Funds_popup"]}&amp;lt;/b&amp;gt;: &amp;lt;a href=${$feature["State_and_Local_Fiscal_Recove_1"]}&amp;gt;${$feature["State_and_Local_Fiscal_Recovery"]}&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;`)}

${when(IsEmpty($feature["F2021_state_legislation_popup"]), null, `&amp;lt;p&amp;gt;&amp;lt;b&amp;gt;${arcade_labdict["2021_state_legislation_popup"]}&amp;lt;/b&amp;gt;: &amp;lt;a href=${$feature["F2021_state_legislation_link"]}&amp;gt;${$feature["F2021_state_legislation_popup"]}&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;`)}

`;

return {

    type: 'text',

    text: displayText // this property supports html tags

};&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Nov 2023 20:10:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expressions-for-hyperlinked-popup-text-do/m-p/1351667#M55985</guid>
      <dc:creator>JACooper</dc:creator>
      <dc:date>2023-11-20T20:10:22Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expressions for hyperlinked popup text do not honor native text formatting</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expressions-for-hyperlinked-popup-text-do/m-p/1351697#M55989</link>
      <description>&lt;P&gt;I don't see any way to do that within the Arcade element, since it strips out the formatting from your text. The only way I can come up with is to use the regular Text element for your text and add the Arcade element for the url. But you'd have to do that for each pair of fields.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Nov 2023 21:14:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expressions-for-hyperlinked-popup-text-do/m-p/1351697#M55989</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2023-11-20T21:14:59Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expressions for hyperlinked popup text do not honor native text formatting</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expressions-for-hyperlinked-popup-text-do/m-p/1356489#M56223</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I made some further discoveries about this and was able to get Arcade popups to respect formatting. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;It looks like according to&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.esri.com/t5/arcgis-enterprise-portal-questions/how-to-include-a-carriage-return-or-newline-into/td-p/1028985" target="_blank" rel="nofollow noopener"&gt;another ESRI forum post about Arcade Popups&lt;/A&gt;&lt;SPAN&gt;, there are several different line breaks for different flavors (based on platform) of Arcade. What is working for me so far is inserting &lt;/SPAN&gt;&lt;FONT face="courier new,courier" color="#0000FF"&gt;&amp;lt;br/&amp;gt;&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;text &lt;STRONG&gt;into the text cell itself&lt;/STRONG&gt; where you want a new line in ArcGIS Online. It seems that raw HTML in the text cell of the actual data of the feature layer is being respected in the Arcade popup generation.&amp;nbsp;&lt;/SPAN&gt;For each of the new lines shown in the image below, there is a&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT face="courier new,courier" color="#0000FF"&gt;&amp;lt;br/&amp;gt;&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;as text in the feature layer's string cell. Likewise,&amp;nbsp;indenting is accomplished by adding &lt;FONT face="courier new,courier" color="#0000FF"&gt;&amp;amp;ensp;&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;for a two spaces gap; and&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT face="courier new,courier" color="#0000FF"&gt;&amp;amp;emsp;&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;for a four spaces gap. Testing confirms these all work.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So, I found a programmatic way to insert &lt;FONT face="courier new,courier" color="#0000FF"&gt;&amp;lt;br/&amp;gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;and &lt;FONT face="courier new,courier" color="#0000FF"&gt;&amp;amp;emsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;characters everywhere I wanted a new line and&amp;nbsp;indentation, respectively, into the pandas dataframe where I was preprocessing data to eventually be written as a GeoJSON. The GeoJSON was then loaded into AGOL as a feature layer, and its string columns were accessed via an arcade script in the format of the code I included in &lt;A href="https://community.esri.com/t5/arcgis-online-questions/arcade-expressions-for-hyperlinked-popup-text-do/m-p/1351667/highlight/true#M55985" target="_self"&gt;the original question&lt;/A&gt;. The process required a (geo)pandas&amp;nbsp;&lt;/SPAN&gt;&lt;FONT face="courier new,courier" color="#0000FF"&gt;.replace('\n','&amp;lt;br/&amp;gt;)&lt;/FONT&gt;&lt;SPAN&gt;&lt;FONT face="courier new,courier" color="#0000FF"&gt;&amp;nbsp;&lt;/FONT&gt;with some encoding tricks to keep the HTML characters valid in the JSON output.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JACooper_1-1701717616666.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/87953i06DDAA4025C226CE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JACooper_1-1701717616666.png" alt="JACooper_1-1701717616666.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Dec 2023 19:20:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expressions-for-hyperlinked-popup-text-do/m-p/1356489#M56223</guid>
      <dc:creator>JACooper</dc:creator>
      <dc:date>2023-12-04T19:20:54Z</dc:date>
    </item>
  </channel>
</rss>

