Class MarkdownWriter
- All Implemented Interfaces:
SymbolDependencyContainer
- Direct Known Subclasses:
SphinxMarkdownWriter
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
Factory to constructMarkdownWriter
s.Nested classes/interfaces inherited from class software.amazon.smithy.docgen.writers.DocWriter
DocWriter.ListType, DocWriter.NoticeType
-
Field Summary
-
Constructor Summary
ConstructorDescriptionMarkdownWriter
(String filename) Constructs a MarkdownWriter.MarkdownWriter
(DocImportContainer importContainer, String filename) Constructs a MarkdownWriter. -
Method Summary
Modifier and TypeMethodDescriptionCloses the body of an admonition.Writes any context needed to close a code block.Writes any context needed to close a definition list.Writes any context needed to close a definition list item.closeList
(DocWriter.ListType listType) Writes any context needed to close a list of the given type.closeListItem
(DocWriter.ListType listType) Writes any context needed to close a list item of the given type.closeTab()
Writes any context needed to close a tab.Writes any context needed to close a tab group.Opens an admonition with a default title.openAdmonition
(DocWriter.NoticeType type, Consumer<DocWriter> titleWriter) Opens an admonition with a custom title.openCodeBlock
(String language) Writes any context needed to open a code block.Writes any context needed to open a definition list.openDefinitionListItem
(Consumer<DocWriter> titleWriter) Writes any context needed to open a definition list item.openHeading
(String content, int level) openList
(DocWriter.ListType listType) Writes any context needed to open a list of the given type.openListItem
(DocWriter.ListType listType) Writes any context needed to open a list item of the given type.Writes any context needed to open a tab.Writes any opening context needed to form a tab group.toString()
Gets the contents of the generated code.writeAnchor
(String linkId) Writes a linkable element to the documentation with the given identifier.writeBadge
(DocWriter.NoticeType type, String text) Writes text as a badge.writeCommonMark
(String commonMark) Writes documentation based on a commonmark string.Methods inherited from class software.amazon.smithy.docgen.writers.DocWriter
closeCodeTab, closeHeading, openCodeTab, openHeading, openHeading, writeShapeDocs
Methods inherited from class software.amazon.smithy.codegen.core.SymbolWriter
addDependency, addImport, addUseImports, addUseImports, getDependencies, getImportContainer, setRelativizeSymbols
Methods inherited from class software.amazon.smithy.utils.AbstractCodeWriter
call, closeBlock, consumer, copySettingsFrom, dedent, dedent, disableNewlines, enableNewlines, enableStackTraceComments, ensureNewline, format, formatLiteral, formatWithStackTraceElement, getContext, getContext, getDebugInfo, getDebugInfo, getExpressionStart, getIndentLevel, getIndentText, getInsertTrailingNewline, getNewline, getNewlinePrefix, getTrimBlankLines, getTrimTrailingSpaces, indent, indent, injectSection, insertTrailingNewline, insertTrailingNewline, isStackTraceRelevant, onSection, onSection, openBlock, openBlock, openBlock, openBlock, openBlock, openBlock, openBlock, openBlock, popState, pushFilteredState, pushState, pushState, pushState, putContext, putContext, putFormatter, removeContext, setExpressionStart, setIndentText, setNewline, setNewline, setNewlinePrefix, trimBlankLines, trimBlankLines, trimTrailingSpaces, trimTrailingSpaces, unwrite, write, writeInline, writeInlineWithNoFormatting, writeOptional, writeWithNoFormatting
-
Constructor Details
-
MarkdownWriter
Constructs a MarkdownWriter.- Parameters:
importContainer
- this file's import container.filename
- The full path to the file being written to.
-
MarkdownWriter
Constructs a MarkdownWriter.- Parameters:
filename
- The full path to the file being written to.
-
-
Method Details
-
writeCommonMark
Description copied from class:DocWriter
Writes documentation based on a commonmark string.Smithy's documentation trait is in the CommonMark format, so writers for formats that aren't based on CommonMark will need to convert the value to their format. This includes raw HTML, which CommonMark allows.
- Specified by:
writeCommonMark
in classDocWriter
- Parameters:
commonMark
- A string containing CommonMark-formatted documentation.- Returns:
- returns the writer.
-
openHeading
-
openDefinitionList
Description copied from class:DocWriter
Writes any context needed to open a definition list.A definition list is a list where each element has an emphasized title or term. A basic way to represent this might be an unordered list where the term is followed by a colon.
This will primarily be used to list members, with the element titles being the member names, member types, and a link to those member types where applicable. It will also be used for resource lifecycle operations, which will have similar titles.
- Specified by:
openDefinitionList
in classDocWriter
- Returns:
- returns the writer.
-
closeDefinitionList
Description copied from class:DocWriter
Writes any context needed to close a definition list.A definition list is a list where each element has an emphasized title or term. A basic way to represent this might be an unordered list where the term is followed by a colon.
This will primarily be used to list members, with the element titles being the member names, member types, and a link to those member types where applicable. It will also be used for resource lifecycle operations, which will have similar titles.
- Specified by:
closeDefinitionList
in classDocWriter
- Returns:
- returns the writer.
-
openDefinitionListItem
Description copied from class:DocWriter
Writes any context needed to open a definition list item.A definition list is a list where each element has an emphasized title or term. A basic way to represent this might be an unordered list where the term is followed by a colon.
This will primarily be used to list members, with the element titles being the member names, member types, and a link to those member types where applicable. It will also be used for resource lifecycle operations, which will have similar titles.
- Specified by:
openDefinitionListItem
in classDocWriter
- Parameters:
titleWriter
- writes the title or term for the definition list item.- Returns:
- returns the writer.
-
closeDefinitionListItem
Description copied from class:DocWriter
Writes any context needed to close a definition list item.A definition list is a list where each element has an emphasized title or term. A basic way to represent this might be an unordered list where the term is followed by a colon.
This will primarily be used to list members, with the element titles being the member names, member types, and a link to those member types where applicable. It will also be used for resource lifecycle operations, which will have similar titles.
- Specified by:
closeDefinitionListItem
in classDocWriter
- Returns:
- returns the writer.
-
writeAnchor
Description copied from class:DocWriter
Writes a linkable element to the documentation with the given identifier.The resulting HTML should be able to link to this anchor with
#linkId
.For example, a direct HTML writer might create a
span
tag with the given string as the tag'sid
, or modify the next emitted tag to have the given id.- Specified by:
writeAnchor
in classDocWriter
- Parameters:
linkId
- The anchor's link identifier.- Returns:
- returns the writer.
-
openTabGroup
Description copied from class:DocWriter
Writes any opening context needed to form a tab group.- Specified by:
openTabGroup
in classDocWriter
- Returns:
- returns the writer.
-
closeTabGroup
Description copied from class:DocWriter
Writes any context needed to close a tab group.- Specified by:
closeTabGroup
in classDocWriter
- Returns:
- returns the writer.
-
openTab
Description copied from class:DocWriter
Writes any context needed to open a tab. -
closeTab
Description copied from class:DocWriter
Writes any context needed to close a tab. -
openCodeBlock
Description copied from class:DocWriter
Writes any context needed to open a code block.For example, a pure HTML writer might write an opening
pre
tag.- Specified by:
openCodeBlock
in classDocWriter
- Parameters:
language
- the language of the block's code.- Returns:
- returns the writer.
-
closeCodeBlock
Description copied from class:DocWriter
Writes any context needed to close a code block.For example, a pure HTML writer might write a closing
pre
tag.- Specified by:
closeCodeBlock
in classDocWriter
- Returns:
- returns the writer.
-
openList
Description copied from class:DocWriter
Writes any context needed to open a list of the given type.For example, a raw HTML writer might write an opening
ul
tag for an unordered list or anol
tag for an ordered list. -
closeList
Description copied from class:DocWriter
Writes any context needed to close a list of the given type.For example, a raw HTML writer might write a closing
ul
tag for an unordered list or anol
tag for an ordered list. -
openListItem
Description copied from class:DocWriter
Writes any context needed to open a list item of the given type.For example, a raw HTML writer might write an opening
li
tag for a list of any type.- Specified by:
openListItem
in classDocWriter
- Parameters:
listType
- The type of list the item is a part of.- Returns:
- returns the writer.
-
closeListItem
Description copied from class:DocWriter
Writes any context needed to close a list item of the given type.For example, a raw HTML writer might write a closing
li
tag for a list of any type.- Specified by:
closeListItem
in classDocWriter
- Parameters:
listType
- The type of list the item is a part of.- Returns:
- returns the writer.
-
toString
Description copied from class:AbstractCodeWriter
Gets the contents of the generated code.The result will have an appended newline if the AbstractCodeWriter is configured to always append a newline. A newline is only appended in these cases if the result does not already end with a newline.
- Overrides:
toString
in classAbstractCodeWriter<DocWriter>
- Returns:
- Returns the generated code.
-
openAdmonition
Description copied from class:DocWriter
Opens an admonition with a custom title.An admonition is an emphasized callout that typically have color-coded severity. A warning admonition, for example, might have a yellow or red banner that emphasizes the importance of the body text.
- Specified by:
openAdmonition
in classDocWriter
- Parameters:
type
- The type of admonition to open.titleWriter
- A consumer that writes out the title.- Returns:
- returns the writer.
-
openAdmonition
Description copied from class:DocWriter
Opens an admonition with a default title.An admonition is an emphasized callout that typically have color-coded severity. A warning admonition, for example, might have a yellow or red banner that emphasizes the importance of the body text.
- Specified by:
openAdmonition
in classDocWriter
- Parameters:
type
- The type of admonition to open.- Returns:
- returns the writer.
-
closeAdmonition
Description copied from class:DocWriter
Closes the body of an admonition.- Specified by:
closeAdmonition
in classDocWriter
- Returns:
- returns the writer.
-
writeBadge
Description copied from class:DocWriter
Writes text as a badge.Implementations SHOULD write inline.
A badge in this context means text enclosed in a color-coded rectangular shape. The color should be based on the given type.
- Specified by:
writeBadge
in classDocWriter
- Parameters:
type
- The notice type of the badge that determines styling.text
- The text to put in the badge.- Returns:
- returns the writer.
-