anchor.diff:      [
        % Quick start
        ?_assert(conv("3 > 4")            == "<p>3 &gt; 4</p>"),
  +     ?_assert(conv("you *sad* bastard") == "<p>you <em>sad</em> bastard</p>"),
  +     ?_assert(conv("you **sad** bastard") == "<p>you <strong>sad</strong> bastard</p>"),
  +     ?_assert(conv("you _sad_ bastard") == "<p>you <em>sad</em> bastard</p>"),
  +     ?_assert(conv("you __sad__ bastard") == "<p>you <strong>sad</strong> bastard</p>"),
  +     ?_assert(conv("you*sad*bastard") == "<p>you*sad*bastard</p>"),
  +     ?_assert(conv("you_sad_bastard") == "<p>you_sad_bastard</p>"),
  +     ?_assert(conv("you \\*sad\\* bastard") == "<p>you *sad* bastard</p>"),
  +     ?_assert(conv("you \\_sad\\_ bastard") == "<p>you _sad_ bastard</p>"),
        % Breaking up in to lines
        ?_assert(conv("blah\nblah")       == "<p>blah\nblah</p>"),
        ?_assert(conv("blah\r\nblah")     == "<p>blah\nblah</p>"),
  
positive.code: l1([$] | T], A1, A2)       -> l1(T, [], [{{inline, close}, "]"}, l2(A1) | A2]);
  l1([?SPACE | T], A1, A2)   -> l1(T, [], [{{ws, sp}, " "}, l2(A1) | A2]);
  l1([?TAB | T], A1, A2)     -> l1(T, [], [{{ws, tab}, "\t"}, l2(A1) | A2]);
  l1([?CR, ?LF | T], A1, A2) -> l1(T, [], [{{linefeed, crlf}, [?CR , ?LF]}, l2(A1) | A2]);
  l1([?LF | T], A1, A2)      -> l1(T, [], [{{linefeed, lf}, [?LF]}, l2(A1) | A2]);
  %% this final clause accumulates line fragments
  l1([H|T], A1, A2)          -> l1(T, [H |A1] , A2).
  
  
negative.code:           {{punc, fullstop}, _} = P | T], Acc) ->
      {esc_normal, flatten([reverse(Acc), N, P | T])};
  %% we accumulate the digits in case we need to escape a full stop in a normal line
  type_ol1([{num, _} = H | T], Acc)  -> type_ol1(T, [H | Acc]);
  type_ol1([{{punc, fullstop}, _},
            {{ws, _}, _} | T], _Acc) -> {ol, T};
  type_ol1(_List, _Acc)              -> normal.
  
  %% strip trailing #'s as they are decorative only...
  type_atx(List) -> Stripped = reverse(strip_atx(reverse(List))),
                    {type_atx1(Stripped), List}.
  
  strip_atx([{{md, atx}, _} | T]) -> strip_atx(T);
  strip_atx(List)                 -> List.
  
  %% this is final clause terminal
  %% can't get a <h3> style header bigger than 6...
  type_atx1(List) -> t_atx1(List, 0).
  
  t_atx1([{{md, atx}, _} | T], 6) -> t_atx1(T, 6);
  t_atx1([{{md, atx}, _} | T], N) -> t_atx1(T, N + 1);
  t_atx1([{{ws, _}, _} | T], N)   -> t_atx1(T, N);
  t_atx1(List, N)                 -> Nh = "h" ++ integer_to_list(N),
                                        Header = list_to_atom(Nh),
                                        {Header, List}.
                   
  type_setext_h1(List) -> type_s_h1_1(List, []).
  
  type_s_h1_1([], Acc)                      -> {setext_h1, reverse(Acc)};
  type_s_h1_1([[] | T], Acc)                -> type_s_h1_1(T, Acc);
  type_s_h1_1([{{md, eq}, _} = H | T], Acc) -> type_s_h1_1(T, [H | Acc]);
  type_s_h1_1(L, Acc) ->
      {normal, [flatten(reverse(Acc)) | L]}.
  
  type_setext_h2(List) ->
      case type_s_h2_1(List) of
          h2_or_hr -> {h2_or_hr, List};
          not_h2   -> {type_s_h2_2(trim_right(List)), List}
      end.                            
  
  type_s_h2_1([])                    -> h2_or_hr;
  