@@ -84,13 +84,21 @@ dropCommentTrees [] = []
8484dropCommentTrees blks@(b:bs) =
8585 maybe blks (flip dropUntilHeaderAboveLevel bs) $ commentHeaderLevel b
8686
87−-- | Return the level of a header starting a comment tree and Nothing
88−-- otherwise.
87+-- | Return the level of a header starting a comment or :noexport: tree and
88+-- Nothing otherwise.
8989commentHeaderLevel :: Block -> Maybe Int
9090commentHeaderLevel blk =
9191 case blk of
92− (Header level _ ((Str "COMMENT"):_)) -> Just level
93− _ -> Nothing
92+ (Header level _ ((Str "COMMENT"):_)) -> Just level
93+ (Header level _ title) | hasNoExportTag title -> Just level
94+ _ -> Nothing
95+ where
96+ hasNoExportTag :: [Inline] -> Bool
97+ hasNoExportTag = any isNoExportTag
98+
99+ isNoExportTag :: Inline -> Bool
100+ isNoExportTag (Span ("", ["tag"], [("data-tag-name", "noexport")]) []) = True
101+ isNoExportTag _ = False
94102
95103-- | Drop blocks until a header on or above the given level is seen
96104dropUntilHeaderAboveLevel :: Int -> [Block] -> [Block]