Class FormatDetector
java.lang.Object
io.jenkins.plugins.interactiveinput.view.FormatDetector
Maps a file name to a
ReviewDocument render format and a Prism language hint.
The format decides how the review page presents the snapshot: markdown is rendered to
safe HTML, everything else (including HTML and any programming language) is shown as
escaped, syntax-highlighted source — the file is never executed. The language string is a
Prism grammar id used by prism-api for highlighting (see
Prism languages); "none" disables
highlighting for plain text.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classImmutable pairing of a render format and a Prism language id. -
Method Summary
Modifier and TypeMethodDescriptionstatic FormatDetector.Detectedstatic FormatDetector.DetectedResolve an explicit user-suppliedformatoverride to aFormatDetector.Detected, falling back to extension detection for the language hint.
-
Method Details
-
detect
- Parameters:
fileName- a file name or path (only the extension / base name is inspected)- Returns:
- the detected format and Prism language (never
null)
-
resolve
@NonNull public static FormatDetector.Detected resolve(@CheckForNull String format, @NonNull String fileName) Resolve an explicit user-suppliedformatoverride to aFormatDetector.Detected, falling back to extension detection for the language hint.- Parameters:
format- one ofmarkdown|html|text|code(case-insensitive); blank means autofileName- used to derive the language hint (and the format whenformatis blank)
-