@@ -313,18 +313,22 @@ data RenderingOptions = RenderingOptions
313 -- ^ How many content types to display for request body examples?
313 -- ^ How many content types to display for request body examples?
314 , _responseExamples :: !ShowContentTypes
314 , _responseExamples :: !ShowContentTypes
315 -- ^ How many content types to display for response body examples?
315 -- ^ How many content types to display for response body examples?
316+ , _notesHeading :: !(Maybe String)
317+ -- ^ Optionally group all 'notes' together under a common heading.
316 } deriving (Show)
318 } deriving (Show)
318-- | Default API generation options.
320-- | Default API generation options.
320-- All content types are shown for both 'requestExamples' and
322-- All content types are shown for both 'requestExamples' and
321−-- 'responseExamples'.
323+-- 'responseExamples'; 'notesHeading' is set to 'Nothing'
324+-- (i.e. un-grouped).
323-- @since 0.11.1
326-- @since 0.11.1
324defRenderingOptions :: RenderingOptions
327defRenderingOptions :: RenderingOptions
325defRenderingOptions = RenderingOptions
328defRenderingOptions = RenderingOptions
326 { _requestExamples = AllContentTypes
329 { _requestExamples = AllContentTypes
327 , _responseExamples = AllContentTypes
330 , _responseExamples = AllContentTypes
331+ , _notesHeading = Nothing
330-- gimme some lenses
334-- gimme some lenses
@@ -615,23 +619,28 @@ markdownWith RenderingOptions{..} api = unlines $
617 notesStr :: [DocNote] -> [String]
621 notesStr :: [DocNote] -> [String]
622+ notesStr = addHeading
618− notesStr = concatMap noteStr
623+ . concatMap noteStr
625+ addHeading nts = maybe nts (\hd -> ("### " ++ hd) : "" : nts) _notesHeading
620 noteStr :: DocNote -> [String]
627 noteStr :: DocNote -> [String]
621 noteStr nt =
628 noteStr nt =
622− ("#### " ++ nt ^. noteTitle) :
629+ (hdr ++ nt ^. noteTitle) :
624 intersperse "" (nt ^. noteBody) ++
631 intersperse "" (nt ^. noteBody) ++
635+ hdr | isJust _notesHeading = "#### "
636+ | otherwise = "### "
629 authStr :: [DocAuthentication] -> [String]
638 authStr :: [DocAuthentication] -> [String]
630 authStr [] = []
639 authStr [] = []
631 authStr auths =
640 authStr auths =
632 let authIntros = mapped %~ view authIntro $ auths
641 let authIntros = mapped %~ view authIntro $ auths
633 clientInfos = mapped %~ view authDataRequired $ auths
642 clientInfos = mapped %~ view authDataRequired $ auths
634− in "#### Authentication":
643+ in "### Authentication":
636 unlines authIntros :
645 unlines authIntros :
@@ -643,7 +652,7 @@ markdownWith RenderingOptions{..} api = unlines $
643 capturesStr :: [DocCapture] -> [String]
652 capturesStr :: [DocCapture] -> [String]
644 capturesStr [] = []
653 capturesStr [] = []
645 capturesStr l =
654 capturesStr l =
646− "#### Captures:" :
655+ "### Captures:" :
648 map captureStr l ++
657 map captureStr l ++
@@ -655,7 +664,7 @@ markdownWith RenderingOptions{..} api = unlines $
655 headersStr :: [Text] -> [String]
664 headersStr :: [Text] -> [String]
656 headersStr [] = []
665 headersStr [] = []
657 headersStr l =
666 headersStr l =
658− "#### Headers:" :
667+ "### Headers:" :
660 map headerStr l ++
669 map headerStr l ++
@@ -667,7 +676,7 @@ markdownWith RenderingOptions{..} api = unlines $
667 paramsStr :: HTTP.Method -> [DocQueryParam] -> [String]
676 paramsStr :: HTTP.Method -> [DocQueryParam] -> [String]
668 paramsStr _ [] = []
677 paramsStr _ [] = []
669 paramsStr m l =
678 paramsStr m l =
670− ("#### " ++ cs m ++ " Parameters:") :
679+ ("### " ++ cs m ++ " Parameters:") :
672 map (paramStr m) l ++
681 map (paramStr m) l ++
@@ -693,7 +702,7 @@ markdownWith RenderingOptions{..} api = unlines $
693 rqbodyStr :: [M.MediaType] -> [(Text, M.MediaType, ByteString)]-> [String]
702 rqbodyStr :: [M.MediaType] -> [(Text, M.MediaType, ByteString)]-> [String]
694 rqbodyStr [] [] = []
703 rqbodyStr [] [] = []
695 rqbodyStr types s =
704 rqbodyStr types s =
696− ["#### Request:", ""]
705+ ["### Request:", ""]
697 <> formatTypes types
706 <> formatTypes types
698 <> formatBodies _requestExamples s
707 <> formatBodies _requestExamples s
@@ -749,7 +758,7 @@ markdownWith RenderingOptions{..} api = unlines $
750 responseStr :: Response -> [String]
759 responseStr :: Response -> [String]
751 responseStr resp =
760 responseStr resp =
752− "#### Response:" :
761+ "### Response:" :
754 ("- Status code " ++ show (resp ^. respStatus)) :
763 ("- Status code " ++ show (resp ^. respStatus)) :
755 ("- Headers: " ++ show (resp ^. respHeaders)) :
764 ("- Headers: " ++ show (resp ^. respHeaders)) :