Browse Source

Updated code to work with code blocks when there are new lines in it.

pull/18/head
jrtechs 5 years ago
parent
commit
fe145214b1
1 changed files with 10 additions and 2 deletions
  1. +10
    -2
      other/markdownParagraphFormatter.py

+ 10
- 2
other/markdownParagraphFormatter.py View File

@ -70,15 +70,23 @@ def wrapMarkdownParagraphsToColLimit(fileName, charLimit):
"""
result = ""
tempResult = ""
inCodeBlock = False
with open(fileName) as file:
for line in file:
if line.strip(" ") == "\n":
if line.startswith("```"):
inCodeBlock = not inCodeBlock
result = result + line
elif inCodeBlock:
result = result + line
elif line.strip(" ") == "\n":
result = result + formatChunk(tempResult, charLimit)
tempResult = ""
result = result + "\n"
else:
tempResult = tempResult + line
print(line)
if tempResult != "":
result = result + formatChunk(tempResult, charLimit)
return result

Loading…
Cancel
Save