Giter VIP home page Giter VIP logo

markdownlabel's Issues

Allow to define bbcode properties in markdown

Right now, some syntax elements are missing a way of setting some of their properties. For example, images have width, height, etc. BBCode has to be used to set those properties.

The attribute syntax described at CommonMark could be implemented to fix this.

For example:

![img](res://some-image.png){width=400 height=500}

The same could be used to set custom heading anchors, e.g.:

# Some heading {#some-custom-anchor}

This is not a priority since most sites that use markdown don't allow this syntax. It would just be a nice to have so we don't have to use BBCode inside Markdown for things like this.

Override `text` setter behavior

Override the text property setter so it modifies the markdown_text property instead of the inherited text property.

This would make the usage consistent with the other label nodes, as with both Label and RichTextLabel you do label.text = "something", while this is useless in MarkdownLabel, where you currently need to do label.markdown_text = "something".

Hide `bbcode_enabled` and `text` properties in the editor

This would make the usage clearer, and the inspector interface cleaner.

Tried this code as shown in Godot proposal #1056 but it is not working for some reason:

func _validate_property(property: Dictionary):
    if property.name in ["bbcode_enabled", "text"]:
    property.usage = PROPERTY_USAGE_NO_EDITOR

Add option to catch unhandled meta links with custom logic using a signal.

Right now unhandled links default to being used as "https://" + meta and instead I think there should be emitted as a signal so another script can listen for the link click

The use for this would be for maybe having a different script load something, or showing a tooltip. Just a way to have a different script listen for a click and then responding to it.

Here's a rough example:

# a new signal for handling unhandled links
signal unhandled_link(meta)

@export var automatic_links := true
# new toggle for the signal option
@export var emit_signal_for_unhandled_links := true;

func _on_meta_clicked(meta: Variant) -> void:
    if not automatic_links:
        return
    # ... same as before ...
    if emit_signal_for_unhandled_links:
        unhandled_link.emit(meta)
    else:
        # original implementation
        OS.shell_open("https://" + meta)

This would allow for link click logic to be handled by a different class, for example one that shows like... a tooltip, or shows a different page.

You could also use a non Markdown custom handler. For example I initially used f^ to denote a desire to call a function

[Hello Click Me!](f^ShowAlert)
signal link_signal(meta)

func _on_meta_clicked(meta: Variant) -> void:
    if meta.begins_with("f^"):
        link_signal.emit(meta)

Just an idea I had after using it for a bit

Add checkbox support

Display checkboxes when parsing [] and [x].
It should also provide a signal when the state changes.

Custom syntax?

Hello!

I was wondering how hard it would be for me to add my own custom syntax? Such as;

?[variableToQuery](Text to display if the variable is true, or that the function that takes that string and looks it up in a dictionary of tags.)

I suspect that I would need to fork, and edit somewhere in this space? :(

 		# Images
 		var img_pattern := "\\!\\[(.*?)\\]\\((.*?)\\)"

Im just looking around for methods to create variable text without creating a parser from scratch myself ๐Ÿ˜…

Many thanks - Gene

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.