민서네집

SyntaxHighlighter 에서 wrap 사용하기 본문

컴퓨터 일반

SyntaxHighlighter 에서 wrap 사용하기

브라이언7 2011. 6. 14. 10:18

역시나 구글에서 검색을 해 보니 SyntaxHighlighter v3 에서 wrap 기능을 사용 못하는 것을 안타까와 하는 사람들이 나 말고 또 있었다.


JQuery 를 이용한 해결책이 나와 있다.

#182 Version 3. Making code wrap.

https://bitbucket.org/alexg/syntaxhighlighter/issue/182/version-3-making-code-wrap 


다음 포스트에서는 글쓴이는 wrap 기능을 위해서 2.1 버전을 사용한다고 한다.

BlogEngine RC 2.0 and SyntaxHighlighter 3.0.83 Line Wrap Problem

http://blog.kaide.net/post/2010/12/20/BlogEngine-RC-20-and-SyntaxHighlighter-3083-Line-Wrap-Problem.aspx


글쓴이가 이슈 제기를 한 포스트. 댓글을 보면 왜 wrap 기능을 넣지 못했는지 원인과 대략적인 해결책이 나와 있다.

Version 3.0 uses a different html layout compared to version 2.0. Wrappings are currently not possible because the current html layout allows no syncing of the height of code lines and their corresponding line numbers.

I think there are three ways to achieve line wrappings again:

  1. Using a table with two columns. One for line numbers, one for code (Similar to SH version 2.x). This is easy to implement but has one big disadvantage. Selecting the code will also select the line numbers. Double clicking the code should then hide the line number column.
  2. Using a numbered html list like Geshi does. Easy to implement but every line number would have a dot at the end. The first-line argument would be possible but requires some code changes.
  3. Leave the html layout like it is in 3.0 but syncing the line heights of the line numbers with their corresponding code line. Doing this with e.g. jquery shouldn't be too difficult but adding such a big library for just one feature makes not really sense.

#224 horizontal line wrapping doesn't work

https://bitbucket.org/alexg/syntaxhighlighter/issue/224/horizontal-line-wrapping-doesnt-work



Comments