diff --git a/src/MdToHTML.hs b/src/MdToHTML.hs index b819607..0b5604e 100644 --- a/src/MdToHTML.hs +++ b/src/MdToHTML.hs @@ -22,6 +22,8 @@ type Parser = Parsec Void T.Text type HeaderLevel = Int +type CssClass = String + newtype URL = URL {getUrl :: String} deriving (Eq) newtype ImgPath = ImgPath {getPath :: String} deriving (Eq) @@ -40,8 +42,8 @@ data MdToken | Code MdToken | Codeblock String | Link MdToken URL - | Image MdToken URL - | Figure MdToken URL + | Image MdToken URL (Maybe [CssClass]) + | Figure MdToken URL (Maybe [CssClass]) | Bold MdToken | Italic MdToken | Strikethrough MdToken @@ -63,8 +65,8 @@ instance Show MdToken where show (Code code) = "" ++ show code ++ "" show (Codeblock code) = show code show (Link txt url) = "" ++ show txt ++ "" - show (Image txt url) = "\""" - show (Figure txt url) = "
\""
" ++ show txt ++ "
" + show (Image txt url cssClasses) = "\"" " class=\"" ++ unwords classes ++ "\"") cssClasses ++ "/>" + show (Figure txt url cssClasses) = "
\"" " class=\"" ++ unwords classes ++ "\"") cssClasses ++ "/>
" ++ show txt ++ "
" show (Bold token) = "" ++ show token ++ "" show (Italic token) = "" ++ show token ++ "" show (Strikethrough token) = "" ++ show token ++ ""