mirror of
				https://gitea.com/gitea/tea.git
				synced 2025-10-31 01:05:26 +01:00 
			
		
		
		
	Handle Invalid Markdown (#218)
markdown: use builtin dark/light theme detection handle invalid markdown Co-authored-by: Norwin Roosen <git@nroo.de> Reviewed-on: https://gitea.com/gitea/tea/pulls/218 Reviewed-by: 6543 <6543@noreply.gitea.io> Reviewed-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
		| @@ -8,24 +8,17 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	"code.gitea.io/sdk/gitea" | ||||
| 	"github.com/charmbracelet/glamour" | ||||
| ) | ||||
|  | ||||
| // IssueDetails print an issue rendered to stdout | ||||
| func IssueDetails(issue *gitea.Issue) { | ||||
|  | ||||
| 	in := fmt.Sprintf("# #%d %s (%s)\n%s created %s\n\n%s\n", issue.Index, | ||||
| 	OutputMarkdown(fmt.Sprintf( | ||||
| 		"# #%d %s (%s)\n%s created %s\n\n%s\n", | ||||
| 		issue.Index, | ||||
| 		issue.Title, | ||||
| 		issue.State, | ||||
| 		issue.Poster.UserName, | ||||
| 		issue.Created.Format("2006-01-02 15:04:05"), | ||||
| 		issue.Body, | ||||
| 	) | ||||
| 	out, err := glamour.Render(in, getGlamourTheme()) | ||||
| 	if err != nil { | ||||
| 		// TODO: better Error handling | ||||
| 		fmt.Printf("Error:\n%v\n\n", err) | ||||
| 		return | ||||
| 	} | ||||
| 	fmt.Print(out) | ||||
| 	)) | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Norwin
					Norwin