Files
zulip/zerver/lib/mdiff.py
Anders Kaseorg 768f9f93cd docs: Capitalize Markdown consistently.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-08-11 10:23:06 -07:00

20 lines
511 B
Python
Executable File

import logging
import os
import subprocess
class DiffException(Exception):
pass
def diff_strings(output: str, expected_output: str) -> str:
mdiff_path = "frontend_tests/zjsunit/mdiff.js"
if not os.path.isfile(mdiff_path): # nocoverage
msg = "Cannot find mdiff for Markdown diff rendering"
logging.error(msg)
raise DiffException(msg)
command = ['node', mdiff_path, output, expected_output]
diff = subprocess.check_output(command).decode('utf-8')
return diff