def add_lightboxes(html: str, lightbox_class: str = "lightbox", wrapper_class: str = "lightbox-wrapper") -> str: counter: int = 0 img_start: int = html.find(" -1: counter += 1 img_end: int = html.find(">", img_start + 4) lightbox: str = f"\n" +\ f"\n" if html[img_start - 3:img_start] == "
" and html[img_end + 1:img_end + 5] == "
": img_start -= 3 img_end += 4 html = html[:img_start] + lightbox + html[img_end + 1:] img_start = html.find(" str: counter: int = 0 start: int = html.find("[°") while start > -1: counter += 1 end: int = html.find("]", start) text: str = html[start + 2:end] sidenote: str = f"\n" +\ f"\n" +\ f"\n" +\ f" {text}\n" +\ f"\n" html = html[:start] + sidenote + html[end + 1:] start = html.find("[°", start + len(sidenote)) return html