Interface ApproximateMarkdownServicePlugin
-
- All Known Implementing Classes:
HtmlToApproximateMarkdownServicePlugin
,MarkdownSlingCacheImpl
public interface ApproximateMarkdownServicePlugin
Implements special treatment for some resources, depending on the actual system.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
ApproximateMarkdownServicePlugin.PluginResult
Result of the plugin execution.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default void
cacheMarkdown(org.apache.sling.api.resource.Resource resource, String markdown)
An optional way to cache calculated markdowns - if a plugin implements this, it can retrieve that onmaybeHandle(Resource, PrintWriter, ApproximateMarkdownService, SlingHttpServletRequest, SlingHttpServletResponse)
.default String
getImageUrl(org.apache.sling.api.resource.Resource imageResource)
Retrieves the imageURL in a way useable for ChatGPT - usually data:image/jpeg;base64,{base64_image} If the plugin cannot handle this resource, it should return null.default Collection<? extends ApproximateMarkdownService.Link>
getMasterLinks(org.apache.sling.api.resource.Resource resource)
If applicable: this returns links to the master from which the current page was created - e.g.ApproximateMarkdownServicePlugin.PluginResult
maybeHandle(org.apache.sling.api.resource.Resource resource, PrintWriter out, ApproximateMarkdownService service, org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response)
Checks whether the resource should be handled by this plugin and if so, handles it by printing an appropriate markdown representation to the PrintWriter.default boolean
resourceRendersAsComponentMatching(org.apache.sling.api.resource.Resource resource, Pattern pattern)
Returns true when the sling:resourceType or one of the sling:resourceSuperType of the sling:resourceType match the pattern.
-
-
-
Method Detail
-
maybeHandle
@Nonnull ApproximateMarkdownServicePlugin.PluginResult maybeHandle(@Nonnull org.apache.sling.api.resource.Resource resource, @Nonnull PrintWriter out, @Nonnull ApproximateMarkdownService service, @Nonnull org.apache.sling.api.SlingHttpServletRequest request, @Nonnull org.apache.sling.api.SlingHttpServletResponse response)
Checks whether the resource should be handled by this plugin and if so, handles it by printing an appropriate markdown representation to the PrintWriter.- Returns:
- what is already handled by this plugin. It is possible to write to the PrintWriter in any case.
-
getImageUrl
@Nullable default String getImageUrl(@Nullable org.apache.sling.api.resource.Resource imageResource)
Retrieves the imageURL in a way useable for ChatGPT - usually data:image/jpeg;base64,{base64_image} If the plugin cannot handle this resource, it should return null.
-
resourceRendersAsComponentMatching
default boolean resourceRendersAsComponentMatching(@Nonnull org.apache.sling.api.resource.Resource resource, @Nonnull Pattern pattern)
Returns true when the sling:resourceType or one of the sling:resourceSuperType of the sling:resourceType match the pattern. Useable to check whether a resource is rendered with a derivation of a certain component.
-
getMasterLinks
@Nonnull default Collection<? extends ApproximateMarkdownService.Link> getMasterLinks(org.apache.sling.api.resource.Resource resource)
If applicable: this returns links to the master from which the current page was created - e.g. an AEM live copy.
-
cacheMarkdown
default void cacheMarkdown(@Nonnull org.apache.sling.api.resource.Resource resource, @Nonnull String markdown)
An optional way to cache calculated markdowns - if a plugin implements this, it can retrieve that onmaybeHandle(Resource, PrintWriter, ApproximateMarkdownService, SlingHttpServletRequest, SlingHttpServletResponse)
.
-
-