Skip to content

Commit

Permalink
Added hr support
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanaz2 committed Sep 30, 2022
1 parent 7cbbdb0 commit 00eff62
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions SSJ.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,10 @@ def markdownSearch(regex, indChars, tag, line):
newLine = line
match = re.search(regex,newLine)
while match != None:
newLine = newLine[:match.span()[0]] + "<" + tag + ">" + newLine[match.span()[0]+indChars:match.span()[1]-indChars] + "</"+ tag +">" + newLine[match.span()[1]:]
if (tag == "hr"):
newLine = newLine[:match.span()[0]] + "<" + tag + ">"+ newLine[match.span()[1]:]
else:
newLine = newLine[:match.span()[0]] + "<" + tag + ">" + newLine[match.span()[0]+indChars:match.span()[1]-indChars] + "</"+ tag +">" + newLine[match.span()[1]:]
match = re.search(regex,newLine)
return newLine

Expand All @@ -151,6 +154,7 @@ def convertMarkdown(line):
#italics
newLine = SSJ.markdownSearch("\*[^*]+\*", 1, "i", newLine)
newLine = SSJ.markdownSearch("_[^*]+_", 1, "i", newLine)

#hr
newLine = SSJ.markdownSearch("\-\-\-[^*]", 3, "hr", newLine)

return newLine

0 comments on commit 00eff62

Please sign in to comment.