Fix ending braces for PreCode
This commit is contained in:
parent
705cfc1d49
commit
f2807779aa
|
@ -40,8 +40,8 @@ var italicRunes = []rune("_")
|
||||||
var strikeRunesMarkdown = []rune("~~")
|
var strikeRunesMarkdown = []rune("~~")
|
||||||
var strikeRunesXEP0393 = []rune("~")
|
var strikeRunesXEP0393 = []rune("~")
|
||||||
var codeRunes = []rune("`")
|
var codeRunes = []rune("`")
|
||||||
var preRuneStart = []rune("```\n")
|
var preRunesStart = []rune("```\n")
|
||||||
var preRuneEnd = []rune("\n```")
|
var preRunesEnd = []rune("\n```")
|
||||||
var quoteRunes = []rune("> ")
|
var quoteRunes = []rune("> ")
|
||||||
var newlineRunes = []rune("\n")
|
var newlineRunes = []rune("\n")
|
||||||
var doubleNewlineRunes = []rune("\n\n")
|
var doubleNewlineRunes = []rune("\n\n")
|
||||||
|
@ -270,10 +270,10 @@ func entityToMarkdown(entity *client.TextEntity, doubledRunes []rune, markupMode
|
||||||
case client.TypeTextEntityTypeCode:
|
case client.TypeTextEntityTypeCode:
|
||||||
return markupBraces(entity, codeRunes, codeRunes)
|
return markupBraces(entity, codeRunes, codeRunes)
|
||||||
case client.TypeTextEntityTypePre:
|
case client.TypeTextEntityTypePre:
|
||||||
return markupBraces(entity, preRuneStart, preRuneEnd)
|
return markupBraces(entity, preRunesStart, preRunesEnd)
|
||||||
case client.TypeTextEntityTypePreCode:
|
case client.TypeTextEntityTypePreCode:
|
||||||
preCode, _ := entity.Type.(*client.TextEntityTypePreCode)
|
preCode, _ := entity.Type.(*client.TextEntityTypePreCode)
|
||||||
return markupBraces(entity, []rune("\n```"+preCode.Language+"\n"), codeRunes)
|
return markupBraces(entity, []rune("\n```"+preCode.Language+"\n"), preRunesEnd)
|
||||||
case client.TypeTextEntityTypeBlockQuote:
|
case client.TypeTextEntityTypeBlockQuote:
|
||||||
return quotePrependNewlines(entity, doubledRunes, MarkupModeMarkdown)
|
return quotePrependNewlines(entity, doubledRunes, MarkupModeMarkdown)
|
||||||
case client.TypeTextEntityTypeTextUrl:
|
case client.TypeTextEntityTypeTextUrl:
|
||||||
|
@ -300,10 +300,10 @@ func entityToXEP0393(entity *client.TextEntity, doubledRunes []rune, markupMode
|
||||||
case client.TypeTextEntityTypeCode:
|
case client.TypeTextEntityTypeCode:
|
||||||
return markupBraces(entity, codeRunes, codeRunes)
|
return markupBraces(entity, codeRunes, codeRunes)
|
||||||
case client.TypeTextEntityTypePre:
|
case client.TypeTextEntityTypePre:
|
||||||
return markupBraces(entity, preRuneStart, preRuneEnd)
|
return markupBraces(entity, preRunesStart, preRunesEnd)
|
||||||
case client.TypeTextEntityTypePreCode:
|
case client.TypeTextEntityTypePreCode:
|
||||||
preCode, _ := entity.Type.(*client.TextEntityTypePreCode)
|
preCode, _ := entity.Type.(*client.TextEntityTypePreCode)
|
||||||
return markupBraces(entity, []rune("\n```"+preCode.Language+"\n"), codeRunes)
|
return markupBraces(entity, []rune("\n```"+preCode.Language+"\n"), preRunesEnd)
|
||||||
case client.TypeTextEntityTypeBlockQuote:
|
case client.TypeTextEntityTypeBlockQuote:
|
||||||
return quotePrependNewlines(entity, doubledRunes, MarkupModeXEP0393)
|
return quotePrependNewlines(entity, doubledRunes, MarkupModeXEP0393)
|
||||||
case client.TypeTextEntityTypeTextUrl:
|
case client.TypeTextEntityTypeTextUrl:
|
||||||
|
|
Loading…
Reference in a new issue