Added MarkdownString type, Deprecated MarkedString #216#238
Added MarkdownString type, Deprecated MarkedString #216#238BugDiver wants to merge 1 commit intosourcegraph:masterfrom
Conversation
Added interface MarkupContent for backword compatibility
|
Can someone please check why the build is broken. It's passing for Any other comments/feedback? |
|
It triggered a data race which I haven't seen before! I filed #244 but it looks very much unrelated to your code. Restarted the CI job. Thanks for the ping. |
|
Thanks, I just read the spec for contents: MarkedString | MarkedString[] | MarkupContentand that type MarkupContent struct {
Kind string // 'plaintext' | 'markdown'
Value string
}I'm almost tempted to drop support for the deprecated Also your PR supports raw strings being converted into |
|
What is preventing The // untested example
func MarkedStringsToMarkupContent(ms []MarkedString) (MarkupContent) {
var b strings.Builder
for i := range ms {
if ms[i].isRawString {
b.WriteString(ms[i].Value)
continue
}
b.WriteString("```")
b.WriteString(ms[i].Language)
b.WriteString("\n")
b.WriteString(ms[i].Value)
b.WriteString("\n")
b.WriteString("```")
if i != len(ms) -1 {
b.WriteString("\n")
}
}
return MarkupContent{
Kind: "markdown",
Value: b.String()
}
} |
Added interface MarkupContent for backword compatibility