mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08:00 
			
		
		
		
	Make highlighted markdown code blocks work on issue pages
This commit is contained in:
		@@ -18,6 +18,9 @@ function initCommentPreviewTab($form) {
 | 
				
			|||||||
                var $preview_tab = $form.find('.tab.segment[data-tab="' + $tab_menu.data('preview') + '"]');
 | 
					                var $preview_tab = $form.find('.tab.segment[data-tab="' + $tab_menu.data('preview') + '"]');
 | 
				
			||||||
                $preview_tab.html(data);
 | 
					                $preview_tab.html(data);
 | 
				
			||||||
                emojify.run($preview_tab[0]);
 | 
					                emojify.run($preview_tab[0]);
 | 
				
			||||||
 | 
					                $('pre code', $preview_tab[0]).each(function(i, block) {
 | 
				
			||||||
 | 
					                    hljs.highlightBlock(block);
 | 
				
			||||||
 | 
					                });
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        );
 | 
					        );
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -291,6 +291,8 @@ func NewIssue(ctx *middleware.Context) {
 | 
				
			|||||||
		return
 | 
							return
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						ctx.Data["RequireHighlightJS"] = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ctx.HTML(200, ISSUE_NEW)
 | 
						ctx.HTML(200, ISSUE_NEW)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -623,6 +625,9 @@ func ViewIssue(ctx *middleware.Context) {
 | 
				
			|||||||
	ctx.Data["Issue"] = issue
 | 
						ctx.Data["Issue"] = issue
 | 
				
			||||||
	ctx.Data["IsIssueOwner"] = ctx.Repo.IsAdmin() || (ctx.IsSigned && issue.IsPoster(ctx.User.Id))
 | 
						ctx.Data["IsIssueOwner"] = ctx.Repo.IsAdmin() || (ctx.IsSigned && issue.IsPoster(ctx.User.Id))
 | 
				
			||||||
	ctx.Data["SignInLink"] = setting.AppSubUrl + "/user/login"
 | 
						ctx.Data["SignInLink"] = setting.AppSubUrl + "/user/login"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						ctx.Data["RequireHighlightJS"] = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ctx.HTML(200, ISSUE_VIEW)
 | 
						ctx.HTML(200, ISSUE_VIEW)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user