diff --git a/src/Text/Sundown/Html.hs b/src/Text/Sundown/Html.hs
new file mode 100644
--- /dev/null
+++ b/src/Text/Sundown/Html.hs
@@ -0,0 +1,61 @@
+{-# LANGUAGE FlexibleInstances #-}
+{-|
+Module exposing a generic class to convert to/from UTF8 'ByteString's, and the
+corresponding generic markdown functions.
+-}
+module Text.Sundown.Html
+    ( renderHtml
+    , smartypants
+      -- * Generic ByteString conversion
+    , ToBS(..)
+    , FromBS(..)
+      -- * Markdown extensions
+    , Extensions (..)
+    , allExtensions
+    , noExtensions
+      -- * Html render modes
+    , HtmlRenderMode(..)
+    , noHtmlModes
+    , allHtmlModes
+    ) where
+
+import Data.ByteString (ByteString)
+import qualified Data.ByteString.UTF8 as BS
+import Data.Text (Text)
+import qualified Data.Text.Encoding as T
+
+import Text.Sundown.Foreign
+import Text.Sundown.Html.ByteString (noHtmlModes, allHtmlModes, HtmlRenderMode(..))
+import qualified Text.Sundown.Html.ByteString as BS
+import Text.Sundown.Html.Foreign
+
+-- | Converts something to an UTF8 'ByteString'.
+class ToBS   a where toBS   :: a -> ByteString
+-- | Converts an UTF8 'ByteString' to something.
+class FromBS a where fromBS :: ByteString -> a
+
+instance ToBS   ByteString where toBS   = id
+instance FromBS ByteString where fromBS = id
+
+instance ToBS   [Char]     where toBS   = BS.fromString
+instance FromBS [Char]     where fromBS = BS.toString
+
+instance ToBS   Text       where toBS   = T.encodeUtf8
+instance FromBS Text       where fromBS = T.decodeUtf8
+
+-- | Parses markdown, returns the Html.
+renderHtml :: (ToBS a, FromBS b)
+           => a
+           -> Extensions
+           -> HtmlRenderMode
+           -> Bool              -- ^ If true, smartypant the output
+           -> Maybe Int
+           -- ^ The maximum nesting of the HTML. If Nothing, a default value
+           -- (16) will be used.
+           -> b
+renderHtml input exts mode sp maxNestingM =
+    fromBS $ BS.renderHtml (toBS input) exts mode sp maxNestingM
+
+smartypants :: (ToBS a, FromBS b) => a -> b
+smartypants = fromBS . BS.smartypants . toBS
+
diff --git a/src/Text/Sundown/Html/String.hs b/src/Text/Sundown/Html/String.hs
--- a/src/Text/Sundown/Html/String.hs
+++ b/src/Text/Sundown/Html/String.hs
@@ -14,7 +14,7 @@
 import Text.Sundown.Html hiding (renderHtml, smartypants)
 import qualified Text.Sundown.Html as Sundown
 
--- | Parses a 'ByteString' containing the markdown, returns the Html code.
+-- | Parses a 'String' containing the markdown, returns the Html code.
 renderHtml :: String
            -> Extensions
            -> HtmlRenderMode
diff --git a/src/Text/Sundown/Html/Text.hs b/src/Text/Sundown/Html/Text.hs
--- a/src/Text/Sundown/Html/Text.hs
+++ b/src/Text/Sundown/Html/Text.hs
@@ -16,7 +16,7 @@
 import Text.Sundown.Html hiding (renderHtml, smartypants)
 import qualified Text.Sundown.Html as Sundown
 
--- | Parses a 'ByteString' containing the markdown, returns the Html code.
+-- | Parses a 'Text' containing the markdown, returns the Html code.
 renderHtml :: Text
            -> Extensions
            -> HtmlRenderMode
diff --git a/sundown.cabal b/sundown.cabal
--- a/sundown.cabal
+++ b/sundown.cabal
@@ -1,6 +1,6 @@
 Cabal-version:      >= 1.6
 Name:               sundown
-Version:            0.5.1
+Version:            0.5.2
 Author:             Francesco Mazzoli (f@mazzo.li)
 Maintainer:         Francesco Mazzoli (f@mazzo.li)
 Build-Type:         Simple
@@ -31,6 +31,7 @@
     Extensions:       EmptyDataDecls, ForeignFunctionInterface
 
     Exposed-Modules:  Text.Sundown,
+                      Text.Sundown.Html,
                       Text.Sundown.Html.ByteString,
                       Text.Sundown.Html.String,
                       Text.Sundown.Html.Text
