Skip to content

Commit

Permalink
Update changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
dbaynard committed Aug 27, 2017
1 parent 38f086a commit c4ed9fa
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
15 changes: 15 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Revision history for skylighting

## Next version

* Wrap lines of source code in a `div` with `display` set to `inline-block`.
The `div`s make per-line processing easier. They cannot be set as
`display: block` as that introduces extra new lines when copying and pasting.
* Render line numbers in html using css pseudo elements rather than a table.
The line numbers are always produced, as `data-line-number` attributes, and
css to display them as `::before` elements are always produced. The option to
switch on line numbering only toggles a class; this means it is possible to toggle
line numbering without re-running skylighting.
* If the `linkAnchors` option is set, wrap with an `a` element rather than a `div`,
set so that clicking the line number (and only the line number) will jump to that
line.
* Code wraps by default when html is printed, with wrapped lines indented.

## 0.3.3.1 -- 2017-06-26

* Updated xml syntax definitions and clojure test.
Expand Down
7 changes: 6 additions & 1 deletion src/Skylighting/Format/HTML.hs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ short InformationTok = "in"
short WarningTok = "wa"
short NormalTok = ""

-- | Each line of source is wrapped in an (inline-block) div that makes
-- subsequent per-line processing (e.g. adding line numnbers) possible.
sourceLineToHtml :: FormatOptions -> LineNo -> SourceLine -> Html
sourceLineToHtml opts lno cont = wrapElement ! A.class_ sourceLine
! A.id lineNum
Expand All @@ -114,7 +116,10 @@ formatHtmlBlockPre opts = H.pre . formatHtmlInline opts
-- | Format tokens as an HTML @pre@ block. Each line is wrapped in a div
-- with the class ‘source-line’. The whole code block is wrapped in a @div@
-- element to aid styling (e.g. the overflow-x property). If line numbering
-- is selected, this surrounding div is given the class ‘number-source’.
-- is selected, this surrounding div is given the class ‘number-source’,
-- and the resulting html will display line numbers thanks to the included
-- css. Note that the html produced will always include the line numbers as
-- the 'data-line-number' attribute.
-- See the documentation for 'formatHtmlInline' for information about how
-- tokens are encoded.
formatHtmlBlock :: FormatOptions -> [SourceLine] -> Html
Expand Down
2 changes: 1 addition & 1 deletion src/Skylighting/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ instance FromJSON TokenType where
-- | A line of source: a list of labeled tokens.
type SourceLine = [Token]

-- | A line of source: a list of labeled tokens.
-- | Line numbers
newtype LineNo = LineNo { lineNo :: Int } deriving (Show, Enum)

-- | A 'TokenStyle' determines how a token is to be rendered.
Expand Down

0 comments on commit c4ed9fa

Please sign in to comment.