tags (text-align and text-indent value). @@ -578,6 +578,9 @@ class HTMLPreprocessor: Process html code to satisfy LawCarta formatting. """ try: + self.logger_object.log(f'Processing TOC and headers.') + self._process_toc_links() + self.clean_trash() # process main elements of the .html doc @@ -609,9 +612,6 @@ class HTMLPreprocessor: self.content = self.body_tag.find_all(recursive=False) - self.logger_object.log(f'Processing TOC and headers.') - self._process_toc_links() - self.top_level_headers = self._get_top_level_headers() self._mark_introduction_headers()