| License | BSD3 |
|---|---|
| Maintainer | The Idris Community. |
| Safe Haskell | None |
| Language | Haskell2010 |
Idris.Docstrings
Description
Synopsis
- data Docstring a = DocString Options (Blocks a)
- data Block a
- data Inline a
- parseDocstring :: Text -> Docstring ()
- renderDocstring :: (a -> String -> Doc OutputAnnotation) -> Docstring a -> Doc OutputAnnotation
- emptyDocstring :: Docstring a
- nullDocstring :: Docstring a -> Bool
- noDocs :: (Docstring a, [(Name, Docstring a)])
- overview :: Docstring a -> Docstring a
- containsText :: Text -> Docstring a -> Bool
- renderHtml :: Docstring DocTerm -> Html
- annotCode :: forall a b. (String -> b) -> Docstring a -> Docstring b
- data DocTerm
- renderDocTerm :: (Term -> Doc OutputAnnotation) -> (Term -> Term) -> DocTerm -> String -> Doc OutputAnnotation
- checkDocstring :: (String -> [String] -> String -> a -> b) -> Docstring a -> Docstring b
Documentation
Representation of Idris's inline documentation. The type paramter represents the type of terms that are associated with code blocks.
Constructors
| DocString Options (Blocks a) |
Instances
| Functor Docstring Source # | |||||
| Foldable Docstring Source # | |||||
Defined in Idris.Docstrings Methods fold :: Monoid m => Docstring m -> m foldMap :: Monoid m => (a -> m) -> Docstring a -> m foldMap' :: Monoid m => (a -> m) -> Docstring a -> m foldr :: (a -> b -> b) -> b -> Docstring a -> b foldr' :: (a -> b -> b) -> b -> Docstring a -> b foldl :: (b -> a -> b) -> b -> Docstring a -> b foldl' :: (b -> a -> b) -> b -> Docstring a -> b foldr1 :: (a -> a -> a) -> Docstring a -> a foldl1 :: (a -> a -> a) -> Docstring a -> a elem :: Eq a => a -> Docstring a -> Bool maximum :: Ord a => Docstring a -> a minimum :: Ord a => Docstring a -> a | |||||
| Traversable Docstring Source # | |||||
| Binary a => Binary (Docstring a) | |||||
| NFData a => NFData (Docstring a) | |||||
Defined in Idris.DeepSeq | |||||
| Generic (Docstring a) Source # | |||||
Defined in Idris.Docstrings Associated Types
| |||||
| Show a => Show (Docstring a) Source # | |||||
| type Rep (Docstring a) Source # | |||||
Defined in Idris.Docstrings type Rep (Docstring a) | |||||
Block-level elements.
Constructors
| Para (Inlines a) | |
| Header Int (Inlines a) | |
| Blockquote (Blocks a) | |
| List Bool ListType [Blocks a] | |
| CodeBlock CodeAttr Text a | |
| HtmlBlock Text | |
| HRule |
Instances
| Functor Block Source # | |||||
| Foldable Block Source # | |||||
Defined in Idris.Docstrings Methods fold :: Monoid m => Block m -> m foldMap :: Monoid m => (a -> m) -> Block a -> m foldMap' :: Monoid m => (a -> m) -> Block a -> m foldr :: (a -> b -> b) -> b -> Block a -> b foldr' :: (a -> b -> b) -> b -> Block a -> b foldl :: (b -> a -> b) -> b -> Block a -> b foldl' :: (b -> a -> b) -> b -> Block a -> b foldr1 :: (a -> a -> a) -> Block a -> a foldl1 :: (a -> a -> a) -> Block a -> a elem :: Eq a => a -> Block a -> Bool maximum :: Ord a => Block a -> a | |||||
| Traversable Block Source # | |||||
| Binary a => Binary (Block a) | |||||
| NFData a => NFData (Block a) | |||||
Defined in Idris.DeepSeq | |||||
| Generic (Block a) Source # | |||||
Defined in Idris.Docstrings Associated Types
| |||||
| Show a => Show (Block a) Source # | |||||
| type Rep (Block a) Source # | |||||
Defined in Idris.Docstrings type Rep (Block a) | |||||
Constructors
| Str Text | |
| Space | |
| SoftBreak | |
| LineBreak | |
| Emph (Inlines a) | |
| Strong (Inlines a) | |
| Code Text a | |
| Link (Inlines a) Text Text | |
| Image (Inlines a) Text Text | |
| Entity Text | |
| RawHtml Text |
Instances
| Functor Inline Source # | |||||
| Foldable Inline Source # | |||||
Defined in Idris.Docstrings Methods fold :: Monoid m => Inline m -> m foldMap :: Monoid m => (a -> m) -> Inline a -> m foldMap' :: Monoid m => (a -> m) -> Inline a -> m foldr :: (a -> b -> b) -> b -> Inline a -> b foldr' :: (a -> b -> b) -> b -> Inline a -> b foldl :: (b -> a -> b) -> b -> Inline a -> b foldl' :: (b -> a -> b) -> b -> Inline a -> b foldr1 :: (a -> a -> a) -> Inline a -> a foldl1 :: (a -> a -> a) -> Inline a -> a elem :: Eq a => a -> Inline a -> Bool maximum :: Ord a => Inline a -> a | |||||
| Traversable Inline Source # | |||||
| Binary a => Binary (Inline a) | |||||
| NFData a => NFData (Inline a) | |||||
Defined in Idris.DeepSeq | |||||
| Generic (Inline a) Source # | |||||
Defined in Idris.Docstrings Associated Types
| |||||
| Show a => Show (Inline a) Source # | |||||
| type Rep (Inline a) Source # | |||||
Defined in Idris.Docstrings type Rep (Inline a) | |||||
parseDocstring :: Text -> Docstring () Source #
Construct a docstring from a Text that contains Markdown-formatted docs
renderDocstring :: (a -> String -> Doc OutputAnnotation) -> Docstring a -> Doc OutputAnnotation Source #
Convert a docstring to be shown by the pretty-printer
emptyDocstring :: Docstring a Source #
The empty docstring
nullDocstring :: Docstring a -> Bool Source #
Check whether a docstring is emtpy
overview :: Docstring a -> Docstring a Source #
Construct a docstring consisting of the first block-level element of the argument docstring, for use in summaries.
containsText :: Text -> Docstring a -> Bool Source #
Does a string occur in the docstring?
renderHtml :: Docstring DocTerm -> Html Source #
Annotate the code samples in a docstring
The various kinds of code samples that can be embedded in docs
Instances
| Binary DocTerm | |||||
| NFData DocTerm | |||||
Defined in Idris.DeepSeq | |||||
| Generic DocTerm Source # | |||||
Defined in Idris.Docstrings Associated Types
| |||||
| Show DocTerm Source # | |||||
| type Rep DocTerm Source # | |||||
Defined in Idris.Docstrings type Rep DocTerm = D1 ('MetaData "DocTerm" "Idris.Docstrings" "idris-1.3.4-HnQR8FAZ4cFLBT8mcBTBaK" 'False) ((C1 ('MetaCons "Unchecked" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Checked" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Term))) :+: (C1 ('MetaCons "Example" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Term)) :+: C1 ('MetaCons "Failing" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Err)))) | |||||
renderDocTerm :: (Term -> Doc OutputAnnotation) -> (Term -> Term) -> DocTerm -> String -> Doc OutputAnnotation Source #
Render a term in the documentation
checkDocstring :: (String -> [String] -> String -> a -> b) -> Docstring a -> Docstring b Source #
Run some kind of processing step over code in a Docstring. The code processor gets the language and annotations as parameters, along with the source and the original annotation.