title: Using HTML tags in JSON data processed by D3.js
body: <p>I am trying to build tables based on JSON data using D3.js.
  My example HTML file is:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;meta charset='utf-8'&gt;
  &lt;html&gt;
  
  &lt;head&gt;
  &lt;script src="http://d3js.org/d3.v5.min.js" charset="utf-8"&gt;&lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;table id="muell"&gt;&lt;/table&gt;
  &lt;script type='text/javascript' src='script.js'&gt;&lt;/script&gt;
  &lt;script&gt;
      var intern_data = [{
              Proton: "A",
              Multiplett: "dd",
              Formel: "\&lt;sup\&gt;1\&lt;/sup\&gt;H\&lt;sub\&gt;3\&lt;/sub\&gt;"
          },
          {
              Proton: "B",
              Multiplett: "dq",
              Formel: "&lt;sup&gt;1&lt;/sup&gt;C&lt;sub&gt;3&lt;/sub&gt;"
          }
      ];
      var spalten = ['Proton', 'Multiplett', 'Formel'];
      tabulate("#muell", intern_data, spalten);
  &lt;/script&gt;
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p>The Javascript is stolen from from bl.ocks.org and became a little bit modified to add the new table content into a preformatted  region.</p>
  
  <pre><code>var tabulate = function (table_id,data, columns) {
  var table = d3.select(table_id)
  var thead = table.append('thead')
  var tbody = table.append('tbody')
  
  thead.append('tr')
      .selectAll('th')
      .data(columns)
      .enter()
      .append('th')
      .text(function (d) {
          return d
      })
  
  var rows = tbody.selectAll('tr')
      .data(data)
      .enter()
      .append('tr')
  
  var cells = rows.selectAll('td')
      .data(function (row) {
          return columns.map(function (column) {
              return {
                  column: column,
                  value: row[column]
              }
          })
      })
      .enter()
      .append('td')
      .text(function (d) {
          return d.value
      })
  
  return table;
  }
  </code></pre>
  
  <p>In principle everything works fine as long as I use plain text. Unfortunately
  HTML tags become modified. For instance ">" becomes "_gt;" (&amp; instead of _, cannot use it here, otherwise the expression becomes ">" :-) ).
  I tried to use \ to keep pure HTML, but this doesn't seem to work.</p>