Error when code examples are improperly closed (#15186)

This commit is contained in:
Sylvain Gugger
2022-01-18 07:27:34 -05:00
committed by GitHub
parent 22454ae492
commit f6d3fee855

View File

@@ -445,6 +445,9 @@ def style_mdx_file(mdx_file, max_len=119, check_only=False):
else:
new_lines.append(line)
if in_code:
raise ValueError(f"There was a problem when styling {mdx_file}. A code block is opened without being closed.")
clean_content = "\n".join(new_lines)
diff = clean_content != content
if not check_only and diff: