diff --git a/html4docx/constants.py b/html4docx/constants.py index 2638462..0c1b410 100644 --- a/html4docx/constants.py +++ b/html4docx/constants.py @@ -31,6 +31,7 @@ 'em': 'italic', 'i': 'italic', 'u': 'underline', + 'ins': 'underline', # HTML5 insertion element - underline like 's': 'strike', 'sup': 'superscript', 'sub': 'subscript', diff --git a/html4docx/h4d.py b/html4docx/h4d.py index 5184e16..ef758ba 100644 --- a/html4docx/h4d.py +++ b/html4docx/h4d.py @@ -1681,6 +1681,19 @@ def handle_data(self, data): font_name = constants.FONT_NAMES[tag] self.run.font.name = font_name + # Handle tag with yellow background highlight + if tag == 'mark': + shd = OxmlElement('w:shd') + shd.set(qn('w:val'), 'clear') + shd.set(qn('w:color'), 'auto') + shd.set(qn('w:fill'), 'FFFF00') # Yellow - default color + r_pr = self.run._element.get_or_add_rPr() + # Remove existing shading if present + existing_shd = r_pr.find(qn('w:shd')) + if existing_shd is not None: + r_pr.remove(existing_shd) + r_pr.append(shd) + if 'style' in attrs and (tag in ['div', 'li', 'pre']): style = utils.parse_dict_string(attrs['style']) self.add_styles_to_run(style)