MarkdownLabel icon indicating copy to clipboard operation
MarkdownLabel copied to clipboard

Provide the transformation as a helper function?

Open Dracks opened this issue 1 year ago • 1 comments

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.

Dracks avatar Jun 17 '24 17:06 Dracks

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.

uniras avatar Sep 28 '24 05:09 uniras

Closing this since direct conversion is not the purpose of this addon. It can be easily achieved by instancing the class as explained in the previous comment though :)

You could also adapt the MarkdownLabel._convert_markdown function into an static function, for easier use.

daenvil avatar Nov 12 '24 20:11 daenvil