public abstract class MarkupFormatter extends AbstractDescribableImpl<MarkupFormatter> implements ExtensionPoint
Use of markup, as opposed to using raw HTML, ensures certain degree of security.
This is an extension point in Hudson, allowing plugins to implement different markup formatters.
Implement the following methods to enable and control CodeMirror syntax highlighting public String getCodeMirrorMode() // return null to disable CodeMirror dynamically public String getCodeMirrorConfig()
This extension point must have a valid config.jelly
that feeds the constructor.
TODO: allow MarkupFormatter
to control the UI that the user uses to edit.
Jenkins.getMarkupFormatter()
ExtensionPoint.LegacyInstancesAreScopedToHudson
Constructor and Description |
---|
MarkupFormatter() |
Modifier and Type | Method and Description |
---|---|
org.kohsuke.stapler.HttpResponse |
doPreviewDescription(String text)
Generate HTML for preview, using markup formatter.
|
MarkupFormatterDescriptor |
getDescriptor()
By default looks for a nested class (conventionally named
DescriptorImpl ) implementing Descriptor and marked with Extension . |
String |
getHelpUrl()
Gets the URL of the help file.
|
String |
translate(String markup) |
abstract void |
translate(String markup,
Writer output)
Given the text, converts that to HTML according to whatever markup rules implicit in the implementation class.
|
public abstract void translate(@CheckForNull String markup, @Nonnull Writer output) throws IOException
Multiple threads can call this method concurrently with different inputs.
output
- Formatted HTML should be sent to this output.IOException
@Nonnull public final String translate(@CheckForNull String markup) throws IOException
IOException
public String getHelpUrl()
public MarkupFormatterDescriptor getDescriptor()
AbstractDescribableImpl
DescriptorImpl
) implementing Descriptor
and marked with Extension
.
Gets the descriptor for this instance.
Descriptor
is a singleton for every concrete Describable
implementation, so if a.getClass() == b.getClass()
then by default
a.getDescriptor() == b.getDescriptor()
as well.
(In rare cases a single implementation class may be used for instances with distinct descriptors.)
getDescriptor
in interface Describable<MarkupFormatter>
getDescriptor
in class AbstractDescribableImpl<MarkupFormatter>
public org.kohsuke.stapler.HttpResponse doPreviewDescription(@QueryParameter String text) throws IOException
IOException
Copyright © 2004–2019. All rights reserved.