on/wenyan.g4"

function rich(txt){
  function anchor(t,other){
    return `<div id="${t.trim()}">${link(t)}${other}</div>`
  }
  function link(t){
    return t.replace(/([A-z]+)/g,`<a href="#$1">$1</a>`)
  }
  var s = "<pre>";
  var txtlines = txt.split("\n");
  for (var i = 0; i < txtlines.length; i++){
    if (txtlines[i].includes(":")){
      var sp = txtlines[i].split(/:/);
      var other = ":"+link(sp[1])
      s += anchor(sp[0],other)
      
    }else{
      s += `<div>${link(txtlines[i])}</div>`;
  