diff --git a/mkdocs2pdf.py b/mkdocs2pdf.py index 0d36204fb23ba39b52c1f5d6e229d142bac1dcbd..76c11dda6d65bb4dde3fc9ca03d962dd76ab065f 100644 --- a/mkdocs2pdf.py +++ b/mkdocs2pdf.py @@ -108,7 +108,11 @@ def convertMdToTex(filePath): if line.strip() == '\\begin{document}': bContent = True for i, line in enumerate(ls): - ls[i] = line.replace('\\includegraphics', '\\includegraphics[max size={\\textwidth}{0.9\\textheight}]').replace('\\begin{figure}[htbp]', '\\begin{figure}[h!]') + l = line + l = l.replace('\\includegraphics', '\\includegraphics[max size={\\textwidth}{0.9\\textheight}]') + l = l.replace('\\begin{figure}[htbp]', '\\begin{figure}[h!]') + l = re.sub(r'(\\subsubsection)({[0-9]+.[0-9]+.[0-9]+)', r'\1*\2', l) + ls[i] = l with open('{}.tex'.format(filePath), 'w') as f: f.writelines(ls)