@@ -233,7 +233,7 @@ def convert(self, source):
233
233
5. The output is written to a string.
234
234
235
235
"""
236
-
236
+ logger . debug ( "Converting markdown file to serialzed XHTML or HTML" )
237
237
# Fix up the source text
238
238
if not source .strip ():
239
239
return '' # a blank Unicode string
@@ -246,20 +246,23 @@ def convert(self, source):
246
246
raise
247
247
248
248
# Split into lines and run the line preprocessors.
249
+ logger .debug ("Split document into lines" )
249
250
self .lines = source .split ("\n " )
250
251
for prep in self .preprocessors :
252
+ logger .debug (f"Running preprocessor prep for { prep .__module__ .__str__ ()} " )
251
253
self .lines = prep .run (self .lines )
252
254
253
- # Parse the high-level elements.
255
+ logger . debug ( " Parse the high-level elements of the file" )
254
256
root = self .parser .parseDocument (self .lines ).getroot ()
255
257
256
- # Run the tree-processors
258
+ logger . debug ( " Run the tree-processors" )
257
259
for treeprocessor in self .treeprocessors :
260
+ logger .debug (f"Running treeprocessor for { treeprocessor .__module__ .__str__ ()} :{ treeprocessor .__class__ .__name__ } " )
258
261
newRoot = treeprocessor .run (root )
259
262
if newRoot is not None :
260
263
root = newRoot
261
264
262
- # Serialize _properly_. Strip top-level tags.
265
+ logger . debug ( " Serialize _properly_. Strip top-level tags." )
263
266
output = self .serializer (root )
264
267
if self .stripTopLevelTags :
265
268
try :
@@ -269,14 +272,14 @@ def convert(self, source):
269
272
output = output [start :end ].strip ()
270
273
except ValueError as e : # pragma: no cover
271
274
if output .strip ().endswith ('<%s />' % self .doc_tag ):
272
- # We have an empty document
275
+ logger . debug ( "Document is empty" )
273
276
output = ''
274
277
else :
275
278
# We have a serious problem
276
279
raise ValueError ('Markdown failed to strip top-level '
277
280
'tags. Document=%r' % output .strip ()) from e
278
281
279
- # Run the text post-processors
282
+ logger . debug ( " Run the text post-processors" )
280
283
for pp in self .postprocessors :
281
284
output = pp .run (output )
282
285
0 commit comments