Interface WebRenderingContext
- All Known Subinterfaces:
CustomElementWebRenderingContext, RecipeWebRenderingContext
@Experimental
@NonExtendable
public interface WebRenderingContext
-
Method Summary
Modifier and TypeMethodDescriptioncompile(guideme.libs.mdast.model.MdAstNode node, guideme.libs.mdast.model.MdAstParent<?> parentNode) Returns the given node compiled to HTML.compileChildren(guideme.libs.mdast.model.MdAstParent<?> parentNode) Returns the children of this node compiled to HTML.compileError(String message) Compile an error message to HTML.Creates the icon of a fluid, or an error if the fluid was not exported.getAssetUrl(String assetPath) Resolves the path from the current page to the given asset, which is for example the path returned by an exported item icon.getAssetUrl(net.minecraft.resources.Identifier resource) Copies a resource fromassets/<namespace>/<path>on the classpath of the website generator into the website and resolves the path from the current page to it.getPageUrl(String pageId) Resolves the path from the current page to another page.guide()Access to the exported guide data.Creates the icon of an item.itemLink(String itemId, @Nullable HtmlFragment content) Creates a link to the primary page of the item, which shows the icon of the item on hover.voidrequireScript(String resourcePath) Includes a script from the classpath of the website generator on the current page.voidrequireStylesheet(String resourcePath) Includes a stylesheet from the classpath of the website generator on the current page, i.e.
-
Method Details
-
guide
ExportedGuide guide()Access to the exported guide data. -
getAssetUrl
-
getAssetUrl
Copies a resource fromassets/<namespace>/<path>on the classpath of the website generator into the website and resolves the path from the current page to it. Use this for static images your renderers need, such as textures from your mods resources.- Throws:
IllegalArgumentException- If the resource does not exist.
-
requireStylesheet
Includes a stylesheet from the classpath of the website generator on the current page, i.e. for the styles your renderer uses. Relativeurl(...)references in it are copied as well.- Parameters:
resourcePath- The path of the stylesheet on the classpath, i.e.modid/web/recipes.css.- Throws:
IllegalArgumentException- If the resource does not exist.
-
requireScript
Includes a script from the classpath of the website generator on the current page. It is loaded with thedeferattribute.- Parameters:
resourcePath- The path of the script on the classpath, i.e.modid/web/recipes.js.- Throws:
IllegalArgumentException- If the resource does not exist.
-
getPageUrl
Resolves the path from the current page to another page.- Throws:
IllegalArgumentException- If the page does not exist.
-
itemIcon
-
fluidIcon
-
itemLink
Creates a link to the primary page of the item, which shows the icon of the item on hover. If the item has no primary page, or it is the current page, no link is created.- Parameters:
content- The content of the link. If null, the name of the item is used.
-
compileError
-
compileChildren
Returns the children of this node compiled to HTML.- Returns:
- the children of this node compiled to HTML
-
compile
HtmlFragment compile(guideme.libs.mdast.model.MdAstNode node, guideme.libs.mdast.model.MdAstParent<?> parentNode) Returns the given node compiled to HTML.- Returns:
- the given node compiled to HTML
-