You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a simple Flex view with two panes, a sort of file explorer on the left and a markdown renderer view on the right
I want to use a custom renderer called glamour and (ideally) simply fmt.Print() the output of the render like it's indicated on the library's wiki.
So I basically want to avoid translating the output from ANSI to TextView using the TranslateANSI() function that defeats the purpose of using this render, is there any way I can do that?
Thanks
The text was updated successfully, but these errors were encountered:
So I basically want to avoid translating the output from ANSI to TextView using the TranslateANSI() function that defeats the purpose of using this render, is there any way I can do that?
This part I don't understand. It seems to me that glamour outputs ANSI escape codes. To display them in a TextView, you'll have to use TranslateANSI(). Or the ANSIWriter if you're dealing with a continuous stream of text.
That's what I thought at first but it seems that I lose some formatting by doing so.
By using the TranslateAnsi() function like this:
funcrender() *tview.TextView {
in:=`# Hello WorldThis is a simple example of Markdown rendering with Glamour!Check out the [other examples](https://github.com/charmbracelet/glamour/tree/master/examples) too.Bye!`out, err:=glamour.Render(string(in), "dark")
iferr!=nil {
log.Fatal(err)
}
view:=tview.NewTextView().SetText(tview.TranslateANSI(out)).SetDynamicColors(true)
returnview
}
I get this output:
While I want to get this:
I read the docs of the function TranslateANSI() and as the name rightly suggests it translates the string while I want to preserve the original formatting.
Is there any way I can avoid to use textView to display the rendered result?
I have a simple Flex view with two panes, a sort of file explorer on the left and a markdown renderer view on the right
I want to use a custom renderer called glamour and (ideally) simply
fmt.Print()
the output of the render like it's indicated on the library's wiki.So I basically want to avoid translating the output from ANSI to
TextView
using theTranslateANSI()
function that defeats the purpose of using this render, is there any way I can do that?Thanks
The text was updated successfully, but these errors were encountered: