#! /usr/bin/env python3
import panflute as pf


def handle_note(elem, doc):
    if isinstance(elem, pf.RawInline) and elem.text == '<mark>':
        elem.text = r'\colorbox{yellow}{'
        elem.format = 'tex'
    if isinstance(elem, pf.RawInline) and elem.text == '</mark>':
        elem.text = '}'
        elem.format = 'tex'
    return elem


def main(doc=None):
    return pf.run_filter(handle_note, doc=doc)


if __name__ == "__main__":
    main()