import slug from "github-slugid" ; import editHTMLElement from "./editHTMLElement" ; param { HTMLElement } heading function addId ( heading ) { if ( heading . attr ( "id" ) ) return ; heading . attr ( "id" , slug ( heading . text ( ) ) ) ; } param { HTMLDom } $ function addHeadingId ( $ ) { return editHTMLElement ( $ , "h1,h2,h3,h4,h5,h6" , addId ) ; } export default addHeadingId ;