diff -ur v47/ezmd.py v48/ezmd.py --- v47/ezmd.py 2020-02-15 11:15:17.000000000 +0900 +++ v48/ezmd.py 2020-07-16 01:04:06.000000000 +0900 @@ -788,12 +788,30 @@ do_mode_ul(buf) return outbuf.pop_tmp() + def a_href_at(o): + def to_org(s): + if s.startswith( '@' ): + s = s [ 1: ] + s = s.replace( '$_', ' ' ) + return s + + href = o.prop.get( 'href' ) + href = to_org( href ) + for (h_i, n, name, s) in hd_names: + if s == href: + o.prop[ 'href' ] = '#' + name + break + o.v = to_org( o.v ) + return o + def f_o(o): if is_lst(o): return flat_map(f_o, o) if is_tag(o): if o.name == 'index': return f( o.v ) + if o.name == 'a' and 'href' in o.prop and o.prop.get( 'href', '' ).startswith( '@' ): + return a_href_at( o ) o.v = f_o( o.v ) return o