diff --git a/changelog.md b/changelog.md
--- a/changelog.md
+++ b/changelog.md
@@ -1,5 +1,14 @@
 # Revision history for skylighting
 
+## 0.4.3 --- 2017-11-02
+
+  * `FormatOptions`: added `lineIdPrefix` (jgm/pandoc#4031).
+    This is needed because a web page may contain several
+    code samples, and we need to make sure that the ids on
+    lines are unique.
+  * HTML formatter: use `lineIdPrefix` in ids for lines.
+  * HTML formatter: Don't put href attributes on divs.
+
 ## 0.4.2 --- 2017-10-26
 
   * HTML output: remove outer div.  This prevented margin
diff --git a/skylighting.cabal b/skylighting.cabal
--- a/skylighting.cabal
+++ b/skylighting.cabal
@@ -1,5 +1,5 @@
 name:                skylighting
-version:             0.4.2
+version:             0.4.3
 synopsis:            syntax highlighting library
 description:         Skylighting is a syntax highlighting library with
                      support for over one hundred languages.  It derives
diff --git a/src/Skylighting/Format/HTML.hs b/src/Skylighting/Format/HTML.hs
--- a/src/Skylighting/Format/HTML.hs
+++ b/src/Skylighting/Format/HTML.hs
@@ -5,6 +5,7 @@
     ) where
 
 import Data.List (intersperse)
+import Data.Monoid ((<>))
 import Data.String (fromString)
 import qualified Data.Text as Text
 import Skylighting.Types
@@ -79,17 +80,20 @@
 -- | 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
-                                       ! A.href lineRef
-                                       ! H.dataAttribute (fromString "line-number") lineNum $
-                                mapM_ (tokenToHtml opts) cont
+sourceLineToHtml opts lno cont =
+  (if lineAnchors opts
+      then H.a   ! A.class_ sourceLine
+                 ! A.id lineNum
+                 ! A.href lineRef
+                 ! dataAttrib
+      else H.div ! A.class_ sourceLine
+                 ! A.id lineNum
+                 ! dataAttrib) $ mapM_ (tokenToHtml opts) cont
   where  sourceLine = toValue "sourceLine"
-         lineNum = toValue . show . lineNo $ lno
-         lineRef = toValue . ('#':) . show . lineNo $ lno
-         wrapElement = if lineAnchors opts
-                then H.a
-                else H.div
+         lineNum = toValue prefixedLineNo
+         lineRef = toValue ('#':prefixedLineNo)
+         prefixedLineNo = Text.unpack (lineIdPrefix opts) <> show (lineNo lno)
+         dataAttrib = H.dataAttribute (fromString "line-number") lineNum
 
 tokenToHtml :: FormatOptions -> Token -> Html
 tokenToHtml _ (NormalTok, txt)  = toHtml txt
diff --git a/src/Skylighting/Types.hs b/src/Skylighting/Types.hs
--- a/src/Skylighting/Types.hs
+++ b/src/Skylighting/Types.hs
@@ -370,6 +370,7 @@
        , titleAttributes  :: Bool     -- ^ Html titles with token types
        , codeClasses      :: [Text]   -- ^ Additional classes for Html code tag
        , containerClasses :: [Text]   -- ^ Additional classes for Html container tag
+       , lineIdPrefix     :: Text     -- ^ Prefix for id attributes on lines
        } deriving (Show, Read, Eq, Ord, Data, Typeable, Generic)
 
 instance Binary FormatOptions
@@ -383,4 +384,5 @@
                     , titleAttributes = False
                     , codeClasses = []
                     , containerClasses = []
+                    , lineIdPrefix = ""
                     }
