FormatDoc is designed to take a large block of heredoc text and replace formatting elements within it. Like a really cheap basic version of Markdown
(str string)
| 112 | // FormatDoc is designed to take a large block of heredoc text and replace formatting elements within it. |
| 113 | // Like a really cheap basic version of Markdown |
| 114 | func FormatDoc(str string) string { |
| 115 | str = regexp.MustCompile("bold\\((.*?)\\)").ReplaceAllString(str, Bold("$1")) |
| 116 | str = regexp.MustCompile("green\\((.*?)\\)").ReplaceAllString(str, Green("$1")) |
| 117 | str = regexp.MustCompile("yellow\\((.*?)\\)").ReplaceAllString(str, Yellow("$1")) |
| 118 | str = regexp.MustCompile("blue\\((.*?)\\)").ReplaceAllString(str, Blue("$1")) |
| 119 | str = regexp.MustCompile("cyan\\((.*?)\\)").ReplaceAllString(str, Cyan("$1")) |
| 120 | str = regexp.MustCompile("magenta\\((.*?)\\)").ReplaceAllString(str, Magenta("$1")) |
| 121 | str = regexp.MustCompile("red\\((.*?)\\)").ReplaceAllString(str, Red("$1")) |
| 122 | str = regexp.MustCompile("dim\\((.*?)\\)").ReplaceAllString(str, Dim("$1")) |
| 123 | return str |
| 124 | } |
no test coverage detected