mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
A more sensible error when markdown fails
This commit is contained in:
parent
e3fabe843a
commit
3fecb610dc
@ -23,7 +23,11 @@ class TXTInput(InputFormatPlugin):
|
||||
ienc = options.input_encoding
|
||||
txt = stream.read().decode(ienc)
|
||||
|
||||
try:
|
||||
html = txt_to_markdown(txt)
|
||||
except RuntimeError:
|
||||
raise ValueError('This txt file has malformed markup, it cannot be'
|
||||
'converted by calibre. See http://daringfireball.net/projects/markdown/syntax')
|
||||
with open('index.html', 'wb') as index:
|
||||
index.write(html.encode('utf-8'))
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user