|  | @@ -183,15 +183,27 @@ func ReplaceLeft(s, old, new string) string {
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  // RenderCommitMessage renders commit message with XSS-safe and special links.
 | 
	
		
			
				|  |  | -func RenderCommitMessage(msg, urlPrefix string, metas map[string]string) template.HTML {
 | 
	
		
			
				|  |  | +func RenderCommitMessage(full bool, msg, urlPrefix string, metas map[string]string) template.HTML {
 | 
	
		
			
				|  |  |  	cleanMsg := template.HTMLEscapeString(msg)
 | 
	
		
			
				|  |  |  	fullMessage := string(base.RenderIssueIndexPattern([]byte(cleanMsg), urlPrefix, metas))
 | 
	
		
			
				|  |  |  	msgLines := strings.Split(strings.TrimSpace(fullMessage), "\n")
 | 
	
		
			
				|  |  | -	for i := range msgLines {
 | 
	
		
			
				|  |  | -		msgLines[i] = ReplaceLeft(msgLines[i], " ", " ")
 | 
	
		
			
				|  |  | +	numLines := len(msgLines)
 | 
	
		
			
				|  |  | +	if numLines == 0 {
 | 
	
		
			
				|  |  | +		return template.HTML("")
 | 
	
		
			
				|  |  | +	} else if !full {
 | 
	
		
			
				|  |  | +		return template.HTML(msgLines[0])
 | 
	
		
			
				|  |  | +	} else if numLines == 1 || (numLines >= 2 && len(msgLines[1]) == 0) {
 | 
	
		
			
				|  |  | +		// First line is a header, standalone or followed by empty line
 | 
	
		
			
				|  |  | +		header := fmt.Sprintf("<h3>%s</h3>", msgLines[0])
 | 
	
		
			
				|  |  | +		if numLines >= 2 {
 | 
	
		
			
				|  |  | +			fullMessage = header + fmt.Sprintf("\n<pre>%s</pre>", strings.Join(msgLines[2:], "\n"))
 | 
	
		
			
				|  |  | +		} else {
 | 
	
		
			
				|  |  | +			fullMessage = header
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +	} else {
 | 
	
		
			
				|  |  | +		// Non-standard git message, there is no header line
 | 
	
		
			
				|  |  | +		fullMessage = fmt.Sprintf("<h4>%s</h4>", strings.Join(msgLines, "<br>"))
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -	fullMessage = strings.Join(msgLines, "<br>")
 | 
	
		
			
				|  |  |  	return template.HTML(fullMessage)
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 |