anchor.diff:  - Things to fix are prefixed with SI: 
   *)
   
  -//
  +///////////////////////////////////////////////////////////////////////////////
   // lib
  -// 
  +///////////////////////////////////////////////////////////////////////////////
    
  - (* We store a forest-like representation of the module namespaces for index generation*)
  +(* We store a forest-like representation of the module namespaces for index generation*)
  +(* SI: not used yet *)
   type mforest =
   | Leaf of string * string
   | Branch of smap<mforest>
   
   let htree : smap<mforest> = smap_create 50
  -(* SI: not used yet *)
   
   // if xo=Some(x) then f x else y
   // SI: use the one in FStar.Option -- there must be one there! 
  
positive.code:             (fun (tycon,doco) -> (tyconvars_documented tycon) || is_some doco)
              tt
      in
      (* either d.doc attached at the top-level decl *)
      match d.doc with 
      | Some  _ -> true
      | _ -> 
          match d.d with 
          (* or it's an fsdoc *)
          | Fsdoc _ -> true
          (* or the tycon is documented *)
          | Tycon(_,ty) -> tycon_documented ty
          (* no other way to document a decl right now *)
          | _ -> false
  
  let document_decl (w:string->unit) (d:decl) = 
    if decl_documented d then 
      (* SI: {begin, '('} to convince ocamlopt *)
      begin
          (* print the decl *)
          let {d = decl; drange = _; doc = fsdoc} = d in
          //w "```fstar"; 
          w (string_of_decl' d.d); 
          //w "```"; 
          (* print the doc, if there's one *)
          (match fsdoc with 
          | Some(doc,_kw) -> w ("\n" ^ doc) (* SI: do something with kw *) 
          | _ -> ()) ;
          w "" // EOL 
      end
    else ()
  
  let document_toplevel name decls = 
    let no_doc_provided = "(* fsdoc: no doc for module " ^ name.str ^ " *)" in 
    let f d = 
      match d.d with 
      | TopLevelModule k -> Some (k,d.doc) 
      | _ -> None in 
    let mdoc = List.tryPick f decls in
    let name, com = match mdoc with
      | Some (n, com) ->
        let com = match com with
        | Some (doc, kw) -> (match List.tryFind (fun (k,v)->k = "summary") kw with
           | None -> doc | Some (_, summary) -> ("summary:"^summary))
        | None -> no_doc_provided in
        (n, com)
      | None -> name, no_doc_provided in
    mdoc, name, com
  
  // SI: seems a bug? The parser definitely picks up a TopLevelModule, but I
  // can't find it here. 
  let exists_toplevel (decls:list<decl>) = 
    let r =
      List.existsb 
          (fun d -> match d.d with | TopLevelModule _ -> true | _ -> false) 
          decls 
    in
    Util.print1 "+ exists_toplevel: %s\n" (U.string_of_bool r)
  
  //
  // modul
  // 
  let document_module (m:modul) =
    (* fsdoc the top-level modul *)
    let name, decls, _mt = match m with
      | Module(n,d) -> n, d, "module"
      | Interface(n,d,_) -> n, d, "interface" in
    exists_toplevel decls ; 
    let mdoc, name, com = document_toplevel name decls in 
    let on = O.prepend_output_dir (name.str^".mk") in
    let fd = open_file_for_writing on in
    let w = append_to_file fd in
    w (format "# module %s" [name.str]);
    w "```fstar"; w (format "%s" [com]); w "```";
    (match mdoc with | Some(_, Some(doc, _)) -> w doc | _ -> ());
    List.iter (document_decl w) decls;
    close_file fd;
    name
  
  
  //
  // entry point 
  //
  let generate (files:list<string>) =
    (* SI: check odir exists. Should mkdir instead. *)
    let odir = O.prepend_output_dir "" in 
    if (U.file_exists odir) then 
      U.print "odir %s ok.\n" [odir]
    else 
      U.print "odir %s doesn't exist. Will crash...\n" [odir];
    (* fsdoc each module into it's own module.mk. *)
    let modules = List.collect (fun fn -> P.parse_file fn) files in
    let mod_names = List.map document_module modules in
    (* write mod_names into index.md *)
    let on = O.prepend_output_dir "index.mk" in 
    let fd = open_file_for_writing on in 
    List.iter (fun m -> append_to_file fd (format "%s" [m.str])) mod_names;
    close_file fd
  
  
negative.code: let string_of_fsdoco d = string_of_optiont (fun x -> "(*" ^ string_of_fsdoc x ^ "*)") "" d
  let string_of_termo t = string_of_optiont term_to_string "" t
  
  // wrap-up s in MD code block.
  let code_wrap s = "```\n" ^ s ^ "\n```\n"
  
  ///////////////////////////////////////////////////////////////////////////////
  // tycon
  ///////////////////////////////////////////////////////////////////////////////
  
  let string_of_tycon tycon = 
      match tycon with 
      | TyconAbstract _ -> "abstract"
  