File tree Expand file tree Collapse file tree 2 files changed +293
-267
lines changed Expand file tree Collapse file tree 2 files changed +293
-267
lines changed Original file line number Diff line number Diff line change 11module Main where
22
33import qualified Data.Text as T
4+ import qualified Data.Text.Encoding as TE
45import qualified Data.Text.IO as TIO
56import Markdown
67import Parser
78import System.Environment (getArgs )
9+ import System.IO (hSetEncoding , stdout , utf8 )
810
911main :: IO ()
1012main = do
13+ -- Set UTF-8 encoding for stdout
14+ hSetEncoding stdout utf8
15+
1116 args <- getArgs
1217 case args of
1318 [" -c" ] -> do
1419 content <- TIO. getContents
15- let html = markdownToHtml content
20+ let html = T. concat [ T. pack " <!DOCTYPE html> \n <html> \n <head> \n <meta charset= \" UTF-8 \" > \n </head> \n <body> \n " , markdownToHtml content, T. pack " \n </body> \n </html> " ]
1621 TIO. putStrLn html
1722 [input, output] -> do
1823 content <- TIO. readFile input
19- let html = markdownToHtml content
24+ let html = T. concat [ T. pack " <!DOCTYPE html> \n <html> \n <head> \n <meta charset= \" UTF-8 \" > \n </head> \n <body> \n " , markdownToHtml content, T. pack " \n </body> \n </html> " ]
2025 TIO. writeFile output html
2126 _ -> putStrLn " Usage: program <input> <output> OR program -c"
You can’t perform that action at this time.
0 commit comments