daenvil / MarkdownLabel

A custom Godot node that extends RichTextLabel to use Markdown instead of BBCode.
MIT License
71 stars 4 forks source link

Provide the transformation as a helper function? #12

Open Dracks opened 3 months ago

Dracks commented 3 months ago

Hello,

One question, will it be possible to provide the transform of markdown to bbcode as a helper function? That way we can use only the code of the transform and not need the full component if not needed?

Thanks, Jaume.

uniras commented 1 week ago

By pasting the MarkdownLabel control:

var mdlabel = get_tree().get_root().get_child(0).get_node("MarkdownLabel")

Alternatively, without pasting the control:

var mdlabel = preload("res://addons/markdownlabel/markdownlabel.gd").new()

This way, you can access the MarkdownLabel class.

It seems that you can convert a markdown string to a BBCode string by calling the mdlabel._convert_markdown method.

Thanks to the GDScript language specification.