docs: public void emit(Object n) {
          int indent = 0;
          int x = 0;
          Level lvl = currentLevel();
  
          if(stage == DocStage.open && (!headless || use_header)) {
              if(use_version) {
                  String header = "--- %YAML:" + YAML.YAML_MAJOR + "." + YAML.YAML_MINOR + " ";
                  write(Pointer.create(header), header.length());
              } else {
                  write(THREE_DASHES, 4);
              }
              stage = DocStage.processing;
          }
  
          if(lvl.spaces >= 0) {
              indent = lvl.spaces + this.indent;
          }
          addLevel(indent, LevelStatus.open);
          Level parent = lvl;
          lvl = currentLevel();
  
          boolean handle = true;
  
          if(this.anchors != null && this.markers.containsKey(n)) {
              long oid = this.markers.get(n);
              if(this.anchors.containsKey(oid)) {
                  String anchor_name = this.anchors.get(oid);
                  if(this.anchored == null) {
                      anchored = new HashMap<String, Object>();
                  }
  
                  if(!anchored.containsKey(anchor_name)) {
                      String an = "&" + anchor_name + " ";
                      if(parent.status == LevelStatus.map && parent.ncount % 2 == 1) {
                          write(QUESTION_MARK_SPACE, 2);
                          parent.status = LevelStatus.mapx;
                      }
  
                      write(Pointer.create(an), an.length());
  
                      this.anchored.put(anchor_name, null);
                      lvl.anctag = 1;
                  } else {
                      String an = "*" + anchor_name;
                      write(Pointer.create(an), an.length());
                      handle = false;
                  }
              }
          }
          
          if(handle) {
              this.emitter_handler.handle(this, n);
          }
  
          popLevel();
          if(lvl_idx == 1) {
              write(NEWLINE, 1);
              this.headless = false;
              this.stage = DocStage.open;
          }
      }