diff --git a/README.md b/README.md index 8c8c36a..e6125b9 100644 --- a/README.md +++ b/README.md @@ -7,27 +7,43 @@ Java Markdown Rendering library ## Usage MineMark is build in a modular system, `minemark-core` is the hearth of everything, it is responsible for parsing the markdown and generating a layout for it. Then you need a rendering implementation to actually render the markdown. -Currently, only an elementa render system is provided, but it is relatively fast to create your own rendering -implementation if you wish to do that. +Currently, there is a Minecraft and Elementa rendering implementation available, but it is relatively easy to create your own if you wish! -Adding MineMark as a dependency: +Adding MineMark as a dependency (latest MineMark version: ![](https://img.shields.io/badge/dynamic/xml?label=%20&query=/metadata/versioning/versions/version[not(contains(text(),%27%2B%27))][last()]&url=https://maven.dediamondpro.dev/releases/dev/dediamondpro/minemark-core/maven-metadata.xml)): ```kt repositories { maven("https://maven.dediamondpro.dev/releases") } dependencies { - // Add the core as a dependency - implementation("dev.dediamondpro:minemark-core:1.0.0") - // Add elementa rendering implementation as a dependency - implementation("dev.dediamondpro:minemark-elementa:1.0.0") + // Add the core as a dependency, replace {version} with the most recent version of MineMark + implementation("dev.dediamondpro:minemark-core:1{version}") + + // Example to add the Minecraft rendering implementation as a dependency, + // replace {platform} with the Minecraft version and mod loader (example: 1.20.4-fabric) + modImplementation("dev.dediamondpro:minemark-minecraft-{platform}:{version}") + + // Example to add the elementa rendering implementation as a dependency + implementation("dev.dediamondpro:minemark-elementa:{version}") } ``` It is recommended to **shade and relocate MineMark** if you are using it in a Minecraft mod since no guarantees will be provided regarding backwards compatibility. -How you render a markdown element will differ from one rendering implementation to another, here is an example of how -you would do it with the elementa rendering implementation: +## Minecraft rendering implementation + +To use the Minecraft rendering implementation you first have to create a markdown drawable like this +```java +MineMarkDrawable markdown = new MineMarkDrawable("This *is* **where** you input your markdown!"); +``` +Then to render it call the draw method. +```java +markdown.draw(x, y, width, mouseX, mouseY, drawContext); +``` + +## Elementa rendering implementation + +You can create an MineMark elementa component like this, it will act like any other elementa component. ```kt MineMarkComponent("This *is* **where** you input your markdown!").constrain { x = 0.pixels() @@ -37,6 +53,7 @@ MineMarkComponent("This *is* **where** you input your markdown!").constrain { ``` ## Creating your own rendering implementation + To create your own rendering implementation, you first have to implement the rendering of the elements you want to support. You can choose what elements you implement, the only requirement is that **you have to provide a text element**. To implement an element, you have to extend its abstract form, for an example for each element I would recommend you @@ -57,4 +74,4 @@ MineMarkCore core = MineMarkCore.