Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Add evmarkup tags for embedding images #3540

Open
InspectorCaracal opened this issue May 14, 2024 · 0 comments
Open

[Feature Request] Add evmarkup tags for embedding images #3540

InspectorCaracal opened this issue May 14, 2024 · 0 comments
Labels
feature-request A suggestion for new functionality. needs-triage Yet to be looked at and verified as an a real issue/feature that could be worked on

Comments

@InspectorCaracal
Copy link
Contributor

InspectorCaracal commented May 14, 2024

Suggested Feature

Evennia currently has very limited MXP support - only links, really, which I think is fair and reasonable. Specifically, Evennia is designed with a built-in webclient, and links are a basic feature for a webclient, since by its very nature a webclient is a webpage and links are a fundamental aspect of webpages.

Another fairly basic feature for a webpage, which MXP has an implementation for as well, is images. It's not uncommon for people to want to take advantage of the webclient's more web-like features and add in images when developing Evennia games. And, while you can currently post images to your webclient, and you can create custom plugins for handling more complex OOB functionality, there's currently no way to actually embed an image into your game's content the way you can embed a link.

Suggested implementation

I propose we add a new markup tag, for example |img, which allows you to put an image directly into your content. For security purposes, this path should be assumed to be within the game server's static content, rather than allowing for embedding images from any and all sources. Using this new markup would thus look similar to this:

|imgcontent/images/goblin.png|img

This would be parsed to reference the file mygame/web/static/content/images/goblin.png via its external URL.

In both the HTML and ANSI parsers, the markup should be identified and parsed in a similar process to the link tags, but looking specifically for matched pairs. Unmatched |img tags will simply be rendered as their normal text.

The HTML parser would produce the standard <img src="image_path"> output, and the ANSI parser would, if the protocol supports the MXP, produce the MXP output of <IMAGE image_path> and otherwise nothing.

Alternate implementation

Both HTML and MXP support a number of additional features on image elements - however, aside from one exception, I believe that the potential benefits to be gained by supporting those features are dramatically outweighed by the increased complexity in supporting them.

That one exception to this, however, is alt text. This is a very valuable feature on image elements, especially when trying to support as wide a range of accessibility on your webclient as possible.

Adding alt text would, however, require a different kind of markup, more similar to the way links are already implemented. This would require a slightly more complex regex match, since unlike clickable text requiring both a link and text, an image does not require alt text along with its image path. My suggested syntax for image markup supporting text would be more like this:

|imcontent/images/goblin.png|ita goblin|ie

or with no alt text:

|imcontent/images/goblin.png|ie

I don't believe the MXP <IMAGE> supports alt text, so this feature would only be relevant for the webclient or other custom protocols using HTML parsing.

@InspectorCaracal InspectorCaracal added feature-request A suggestion for new functionality. needs-triage Yet to be looked at and verified as an a real issue/feature that could be worked on labels May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A suggestion for new functionality. needs-triage Yet to be looked at and verified as an a real issue/feature that could be worked on
Projects
None yet
Development

No branches or pull requests

1 participant