jugglerchris/rust-html2text

new_sub_renderer can be called with 0 size (causing a panic!)

lewisdiamond opened this issue · 2 comments

see

let mut sub_builder = builder.new_sub_renderer(builder.width()-(1+level));

The problem seems to be related to Headers inside Tables.

      #[test]
      fn test_header_width() {
          //0 size
          test_html(
              br##"
              <h2>
                  <table>
                              <h3>Anything</h3>
                  </table>
              </h2>
  "##,
              r#"## ### An
  ## ### yt
  ## ### hi
  ## ### ng

  ─────
  "#,
              7,
          );

Thanks for the report! I'll take a look at the PR.