 @_ESC = {}
 
 #-----------------------------------------------------------------------------------------------------------
-### TAINT don't keep state here ###
-@_ESC.registry              = []
-@_ESC.registry_index        = new Map()
+@_ESC.initialize = ( state ) =>
+  state[ '_ESC' ] =
+    registry:   []
+    index:      new Map()
 
 #-----------------------------------------------------------------------------------------------------------
 ### Code duplication ###

    $2           ?= ''
    $1           += $2
    raw_content   = $3 ? ''
    key           = @_ESC.register_content 'comment', raw_content.trim()
    return "#{$1}\x15#{key}\x13"
  #.........................................................................................................
  R = R.replace @_ESC.do_bracketed_pattern, ( _, $1, $2, $3 ) =>

    .pipe @_ESC.$expand_actions                 state
    .pipe @_ESC.$expand_raw_spans               state
    .pipe @_ESC.$expand_do_spans                state
    .pipe @_PRE.$process_end_command            state
    .pipe R
  #.........................................................................................................
  R.on 'resume', =>
    md_parser   = @_new_markdown_parser()
    ### for `environment` see https://markdown-it.github.io/markdown-it/#MarkdownIt.parse ###
    ### TAINT environment becomes important for footnotes ###
    environment = {}
    @_ESC.initialize state
    md_source   = @_ESC.escape_html_comments_raw_spans_and_commands state, md_source
    urge 'registry    ', state[ '_ESC' ][ 'registry' ]
    urge 'index       ', state[ '_ESC' ][ 'index' ]
    tokens      = md_parser.parse md_source, environment
    # @set_meta R, 'environment', environment
    confluence.write token for token in tokens
