      superscript: false
      code: false
      link: false
+     heading: false
 
     blankLine: (state) ->
-     state.bold = false
-     state.italics = false
-     state.subscript = false
-     state.superscript = false
-     state.code = false
-     state.link = false
+     clearState state
 
     token: (stream, state) ->
      if stream.sol()
       state.start = true
+      if state.heading
+       state.heading = false
+       clearState state
+
       s = stream.eatSpace()
       if stream.eol()
-       state.bold = false
-       state.italics = false
-       state.subscript = false
-       state.superscript = false
-       state.code = false
-       state.link = false
+       clearState state
 
       return "" if s
 

    return operator

   return null

  matchInline = (stream, state) ->
   match = stream.match /^\*\*/

       else
        break

      types =
       sidenote: false
       html: false
       special: false
       code: false

      for t in stack
       types[t.type] = true

      if not types.code and not types.html
       match = matchBlock stream, state
       return match if match?

     types =
      sidenote: false
