class HtmlWriter implements DataWriter<HtmlWriteOptions> {

  private static final HtmlWriter INSTANCE = new HtmlWriter();

  static {
    register(Table.defaultWriterRegistry);
  }

  public static void register(WriterRegistry registry) {
    registry.registerExtension("html", INSTANCE);
    registry.registerOptions(HtmlWriteOptions.class, INSTANCE);
  }

  public void write(Table table, HtmlWriteOptions options) {<FILL_FUNCTION_BODY>}

  /** Returns a string containing the html output of one table row */
  private static Element row(
      int row, Table table, ElementCreator elements, HtmlWriteOptions options) {
    Element tr = elements.create("tr", null, row);
    for (Column<?> col : table.columns()) {
      if (options.escapeText()) {
        tr.appendChild(
            elements.create("td", col, row).appendText(String.valueOf(col.getString(row))));
      } else {
        tr.appendChild(
            elements
                .create("td", col, row)
                .appendChild(new DataNode(String.valueOf(col.getString(row)))));
      }
    }
    return tr;
  }

  private static Element header(List<Column<?>> cols, ElementCreator elements) {
    Element thead = elements.create("thead");
    Element tr = elements.create("tr");
    thead.appendChild(tr);
    for (Column<?> col : cols) {
      tr.appendChild(elements.create("th", col, null).appendText(col.name()));
    }
    return thead;
  }

  @Override
  public void write(Table table, Destination dest) {
    write(table, HtmlWriteOptions.builder(dest).build());
  }
}

    ElementCreator elements = options.elementCreator();
    Element html = elements.create("table");
    html.appendChild(header(table.columns(), elements));

    Element tbody = elements.create("tbody");
    html.appendChild(tbody);
    for (int row = 0; row < table.rowCount(); row++) {
      tbody.appendChild(row(row, table, elements, options));
    }

    try (Writer writer = options.destination().createWriter()) {
      writer.write(html.toString());
    } catch (IOException e) {
      throw new RuntimeIOException(e);
    }
  
<no_super_class>