org-mode-lucid 1.0.1 → 1.1.0
raw patch · 3 files changed
+31/−10 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Data.Org.Lucid: [highlighting] :: OrgStyle -> Highlighting
+ Data.Org.Lucid: codeHTML :: Highlighting
+ Data.Org.Lucid: type Highlighting = Maybe Language -> Text -> Html ()
- Data.Org.Lucid: OrgStyle :: Bool -> Maybe TOC -> Bool -> OrgStyle
+ Data.Org.Lucid: OrgStyle :: Bool -> Maybe TOC -> Bool -> Highlighting -> OrgStyle
Files
- CHANGELOG.md +10/−0
- lib/Data/Org/Lucid.hs +20/−9
- org-mode-lucid.cabal +1/−1
CHANGELOG.md view
@@ -1,5 +1,15 @@ # Changelog +## 1.1.0 (2020-03-07)++#### Changed++- `OrgStyle` given a new field `highlighting` which allows one to inject+ customized rendering behaviour for Org source blocks. Combined with+ `skylighting-lucid`, this can be used for server-side syntax highlighting.+- Inlined `<code>` tags resulting from org highlighting with `~~` now also have+ an `org-highlighting` class.+ ## 1.0.1 (2020-03-06) #### Fixed
lib/Data/Org/Lucid.hs view
@@ -20,6 +20,8 @@ , OrgStyle(..) , defaultStyle , TOC(..)+ , Highlighting+ , codeHTML ) where import Control.Monad (when)@@ -45,6 +47,8 @@ -- depth is configurable. , bootstrap :: Bool -- ^ Whether to add Twitter Bootstrap classes to certain elements.+ , highlighting :: Highlighting+ -- ^ A function to give @\<code\>@ blocks syntax highlighting. } -- | Options for rendering a Table of Contents in the document.@@ -55,11 +59,14 @@ -- ^ The number of levels to give the TOC. } +-- | A function to give @\<code\>@ blocks syntax highlighting.+type Highlighting = Maybe Language -> T.Text -> Html ()+ -- | Include the title and 3-level TOC named @Table of Contents@, and don't -- include Twitter Bootstrap classes. This mirrors the behaviour of Emacs' -- native HTML export functionality. defaultStyle :: OrgStyle-defaultStyle = OrgStyle True (Just $ TOC "Table of Contents" 3) False+defaultStyle = OrgStyle True (Just $ TOC "Table of Contents" 3) False codeHTML -- | Convert a parsed `OrgFile` into a full HTML document readable in a browser. html :: OrgStyle -> OrgFile -> Html ()@@ -120,15 +127,19 @@ blockHTML :: OrgStyle -> Block -> Html () blockHTML os b = case b of- Quote t -> blockquote_ . p_ $ toHtml t- Example t -> pre_ [class_ "example"] $ toHtml t- Code l t -> div_ [class_ "org-src-container"]- $ pre_ [classes_ $ "src" : maybe [] (\(Language l') -> ["src-" <> l']) l]- $ toHtml t- List is -> listItemsHTML is- Table rw -> tableHTML os rw+ Quote t -> blockquote_ . p_ $ toHtml t+ Example t -> pre_ [class_ "example"] $ toHtml t+ Code l t -> highlighting os l t+ List is -> listItemsHTML is+ Table rw -> tableHTML os rw Paragraph ws -> p_ $ paragraphHTML ws +-- | Mimicks the functionality of Emacs' native HTML export.+codeHTML :: Highlighting+codeHTML l t = div_ [class_ "org-src-container"]+ $ pre_ [classes_ $ "src" : maybe [] (\(Language l') -> ["src-" <> l']) l]+ $ toHtml t+ paragraphHTML :: NonEmpty Words -> Html () paragraphHTML (h :| t) = wordsHTML h <> para h t where@@ -188,7 +199,7 @@ wordsHTML ws = case ws of Bold t -> b_ $ toHtml t Italic t -> i_ $ toHtml t- Highlight t -> code_ $ toHtml t+ Highlight t -> code_ [class_ "org-highlight"] $ toHtml t Underline t -> span_ [style_ "text-decoration: underline;"] $ toHtml t Verbatim t -> toHtml t Strike t -> span_ [style_ "text-decoration: line-through;"] $ toHtml t
org-mode-lucid.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.2 name: org-mode-lucid-version: 1.0.1+version: 1.1.0 description: Lucid integration for org-mode. homepage: https://github.com/fosskers/org-mode author: Colin Woodbury