diff --git a/mkdocs_with_pdf/drivers/relaxedjs.py b/mkdocs_with_pdf/drivers/relaxedjs.py index a0177ad2..dbe0a584 100644 --- a/mkdocs_with_pdf/drivers/relaxedjs.py +++ b/mkdocs_with_pdf/drivers/relaxedjs.py @@ -42,3 +42,7 @@ def write_pdf(self, html_string: str, output: str): self._logger.info(f" {log}") if proc.poll() is not None: break + # workaround for '--build-once' not working + if log.find("Now idle and waiting for file changes") > -1: + proc.kill() + break diff --git a/mkdocs_with_pdf/utils/image_util.py b/mkdocs_with_pdf/utils/image_util.py index 3e73506d..21d69b4d 100644 --- a/mkdocs_with_pdf/utils/image_util.py +++ b/mkdocs_with_pdf/utils/image_util.py @@ -15,7 +15,12 @@ def fix_image_alignment(soup: PageElement, logger: Logger = None): if img.has_attr('class') and 'twemoji' in img['class']: continue - styles = _parse_style(getattr(img, 'style', '')) + if not (img.has_attr('align') + or img.has_attr('width') + or img.has_attr('height')): + continue + + styles = _parse_style(img.get('style', '')) logger.debug(f' | {img}') if img.has_attr('align'):