diff --git a/app/assets/javascripts/pastes.js.coffee b/app/assets/javascripts/pastes.js.coffee index cf33fea..64a46d8 100644 --- a/app/assets/javascripts/pastes.js.coffee +++ b/app/assets/javascripts/pastes.js.coffee @@ -2,5 +2,12 @@ # All this logic will automatically be available in application.js. # You can use CoffeeScript in this file: http://coffeescript.org/ $(document).on 'ready page:load', -> - $(".highlight pre code").each (i, e) -> - hljs.highlightBlock e + $(".code pre code").each (i, e) -> + hljs.highlightBlock e + numberLines e + +numberLines = (e) -> + $('.line-numbers').html([1..lineCount(e)].join("
")) + +lineCount = (e) -> + $(e).html().split("\n").length - 1 diff --git a/app/assets/stylesheets/highlight.css b/app/assets/stylesheets/highlight.css index 05e32a7..a84b6c6 100644 --- a/app/assets/stylesheets/highlight.css +++ b/app/assets/stylesheets/highlight.css @@ -6,7 +6,6 @@ Original style from softwaremaniacs.org (c) Ivan Sagalaev
<%= @paste.content %>
+
+
+
<%= @paste.content %>
+