anchor.diff:                             prevLine := <<>>,
                              soFar    := Html2});
           false ->
  -            ST2 = [{ptext, <<CT/binary, Char:8>>}|St],
  +            ST2 = [{p, <<CT/binary, Char:8>>}|St],
               convert(Rest, State#{currLine := <<Char:8>>,
                                    state    := ST2})
       end;
   
  -%% Parse ptext
  -convert(<<Char:8, Rest/binary>>, State = #{state    := [{ptext, CT}|St],
  +%% Parse paragraph
  +convert(<<Char:8, Rest/binary>>, State = #{state    := [{p, CT}|St],
                                              currLine := CL}) ->
       convert(Rest, State#{currLine := <<CL/binary, Char:8>>,
  -                         state    := [{ptext, <<CT/binary, Char:8>>}|St]});
  +                         state    := [{p, <<CT/binary, Char:8>>}|St]});
   
   %% Text end by end of data
  -convert(<<>>, #{state := [{ptext, <<>>}|_],
  +convert(<<>>, #{state := [{p, <<>>}|_],
                   soFar := Html}) ->
       Html;
  -convert(<<>>, #{state    := [{ptext, CT}|_],
  +convert(<<>>, #{state    := [{p, CT}|_],
                   prevLine := <<>>,
                   soFar    := Html}) ->
       BinTag = makeTag(p, <<CT/binary>>),
       <<Html/binary, BinTag/binary>>;
  -convert(<<>>, #{state    := [{ptext, CT}|_],
  +convert(<<>>, #{state    := [{p, CT}|_],
                   prevLine := PL,
                   currLine := CL,
                   soFar    := Html}) ->
  
positive.code:             convert(Rest2, State#{state := [{Tag, <<>>}|St],
                                    soFar := Html2});
          false ->
              convert(Rest, State#{state := [{ptext, <<CT/binary, "#">>}|St]})
      end;
  
  %% Header end by end of data
  
negative.code:             BinTag = makeTag(p, <<CT/binary>>),
              <<Html/binary, BinTag/binary>>
      end;
  
  %% Parse Lists
  convert(Content, State = #{state := [ol_start|St],
                             soFar := Html}) ->
      {true, NumBin, Rest} = parseOLNum(Content),
      Indent = byte_size(Content) - byte_size(Rest),
      Html2 = <<Html/binary, "<ol start='", NumBin/binary, "'>">>,
      convert(Rest, State#{state := [{ol, Indent, <<>>}|St], soFar := Html2});
  convert(Content, State = #{state := [ul_start|St], soFar := Html}) ->
      {true, Rest} = parseULBullet(Content),
      Indent       = byte_size(Content) - byte_size(Rest),
      Html2        = <<Html/binary, "<ul>">>,
      convert(Rest, State#{state := [{ul, Indent, <<>>}|St], soFar := Html2});
  convert(<<>>, #{state := PState = [{Tag, _, CT}|_],
                  soFar := Html}) when (Tag == ul) or (Tag == ol) ->
      BinTag         = makeTag(li, CT),
      {CloseTags, _} = closeTags(0, PState),
      <<Html/binary, BinTag/binary, CloseTags/binary>>;
  convert(<<13, 10, Rest/binary>>, State = #{state := [{Tag, Ind, CT}|St],
                                             soFar := Html})
      when (Tag == ol) or (Tag == ul) ->
      BinTag = makeTag(li, CT),
      case {Tag, parseList(Tag, Rest, Ind)} of
          {_, {true, Rest2}} ->
              Indent2 = byte_size(Rest) - byte_size(Rest2),
              checkIndent(ul, Indent2, <<>>, Rest2, BinTag, State);
          {_, {true, Num, Rest2}} ->
              Indent2 = byte_size(Rest) - byte_size(Rest2),
              checkIndent(ol, Indent2, Num, Rest2, BinTag, State);
          {ul, false} ->
              Html2 = <<Html/binary, BinTag/binary, "</ul>">>,
              convert(Rest, State#{state := St, soFar := Html2});
          {ol, false} ->
              Html2 = <<Html/binary, BinTag/binary, "</ol>">>,
              convert(Rest, State#{state := St, soFar := Html2})
      end;
  convert(<<Char:8, Rest/binary>>, State = #{state := [{Tag, Ind, CT}|St]})
      when (Tag == ol) or (Tag == ul) ->
      convert(Rest, State#{state := [{Tag, Ind, <<CT/binary, Char:8>>}|St]}).
  
  
  %% Check indentation of ordered and unorded lists.
  checkIndent(_, Indent, _, Rest, BinTag, State = #{state := [{Tag, Indent, CT}|St],
                                                    soFar := Html}) ->
      BinTag = makeTag(li, CT),
      convert(Rest, State#{state := [{Tag, Indent, <<>>}|St],
                           soFar := <<Html/binary, BinTag/binary>>});
  checkIndent(Tag, Ind1, Num, Rest, BinTag, State = #{state := [{PTag, Ind2, CT}|St],
                                                      soFar := Html}) ->
      case Ind1 > Ind2 of
          true ->
              BinTag   = makeTag(li, CT),
              NewState = [{Tag, Ind1, <<>>}, {PTag, Ind2, <<>>}|St],
              StartTag = makeStartTag(Tag, Num),
              Html2    = <<Html/binary, BinTag/binary, StartTag/binary>>,
              convert(Rest, State#{state := NewState,
                                   soFar := Html2});
          false ->
              {CTags, PState} = closeTags(Ind1, [{PTag, Ind2, CT}|St]),
              Html2 = <<Html/binary, BinTag/binary, CTags/binary>>,
              convert(Rest, State#{state := PState,
                                   soFar := Html2})
      end.
  
  makeStartTag(ol, Num) ->
      <<"<ol start='", Num/binary, "'>">>;
  makeStartTag(ul, _Num) ->
      <<"<ul>">>.
  
  % Close tags left open or to a specific indentation(used by lists)
  closeTags(Ind, PState) ->
      closeTags(Ind, PState, <<>>).
  
  closeTags(_Ind, [], SoFar) ->
      {SoFar, []};
  closeTags(Ind, [{ul, Ind, CT}|Rest], SoFar) ->
      {SoFar, [{ul, Ind, CT}|Rest]};
  closeTags(Ind1, [{ul, Ind2, _}|Rest], SoFar) when Ind1 < Ind2 ->
      closeTags(Ind1, Rest, <<SoFar/binary, "</ul>">>);
  closeTags(Ind, [{ol, Ind, CT}|Rest], SoFar) ->
      {SoFar, [{ol, Ind, CT}|Rest]};
  closeTags(Ind1, [{ol, Ind2, _}|Rest], SoFar) when Ind1 < Ind2 ->
      closeTags(Ind1, Rest, <<SoFar/binary, "</ol>">>);
  closeTags(_Ind, PState, SoFar) ->
      {SoFar, PState}.
  