...

Source file src/github.com/jedib0t/go-pretty/v6/list/render_markdown.go

Documentation: github.com/jedib0t/go-pretty/v6/list

     1  package list
     2  
     3  // RenderMarkdown renders the List in the Markdown format. Example:
     4  //    * Game Of Thrones
     5  //      * Winter
     6  //      * Is
     7  //      * Coming
     8  //        * This
     9  //        * Is
    10  //        * Known
    11  //    * The Dark Tower
    12  //      * The Gunslinger
    13  func (l *List) RenderMarkdown() string {
    14  	// make a copy of the original style and ensure it is restored on exit
    15  	originalStyle := l.style
    16  	defer func() {
    17  		if originalStyle == nil {
    18  			l.style = nil
    19  		} else {
    20  			l.SetStyle(*originalStyle)
    21  		}
    22  	}()
    23  
    24  	// override whatever style was set with StyleMarkdown
    25  	l.SetStyle(StyleMarkdown)
    26  
    27  	// render like a regular list
    28  	return l.Render()
    29  }
    30  

View as plain text