     processed_md = vm.md_pre_process(vm.get_md())
     _html_dom = $('<div></div>')
     _html_dom.html($window.marked(processed_md, {sanitize: true}))
-    vm.html_post_process(_html_dom).then () ->
+    return vm.html_post_process(_html_dom).then () ->
       jq_html_div.empty()
       jq_html_div.append(_html_dom)
 

  vm.save_current_note_to_db = () ->
    if vm.is_note_dirty()
      console.log('current note is dirty, saving to db...')
      note_info =
        guid: vm.get_guid()
        # we don't need to care about title now,
        # because real title will be produced when syncing local notes to remote
        title: vm.get_title()
        md: vm.get_md()
      noteManager.update_note(note_info).then(
        (note) ->
          console.log('dirty note successfully saved to db: ' + JSON.stringify(note) + ', set it to not dirty.')
          vm.set_note_dirty(false)
        (error) ->
          alert('update note failed in save_current_note_to_db(): ' + JSON.stringify(error))
      ).catch (error) => alert('failed to save current note to db!')

  # ------------------------------------------------------------------------------------------------------------------
  # App Status


  vm.get_enml_and_title_from_md = (md) ->
    html_div_hidden = $('#md_html_div_hidden')
    # return a promise
    return enmlRenderer.get_enml_and_title_promise(
      html_div_hidden,
      vm.render_html,
      md
    )

  # ------------------------------------------------------------------------------------------------------------------
  # Debugging methods
