mudlet/src/TMxpHRTagHandler.h
Mike Conley b2fc38e1a8
Add: MXP support for H1-H6, HR, SMALL, and TT HTML tags (#8488)
#### Brief overview of PR changes/additions

Adds support for additional MXP 1.0 HTML tags:
- **HR tag**: Renders a horizontal rule (line of dashes) spanning the
full console width
- **H1-H6, SMALL, TT tags**: Recognized and parsed without visual
styling changes

The HR tag automatically adjusts to each profile's wrap width setting
and properly handles line breaks, ensuring text before and after the
horizontal rule appears correctly.

#### Motivation for adding to Mudlet

Improves MXP compliance with the MXP 1.0 specification, allowing MUDs to
use more HTML formatting tags. The HR tag provides a visual separator
for content sections, useful for menus, help text, and scene
transitions.

#### Other info (issues closed, discussion etc)

Closes #8481

**Implementation notes:**
- Variable font sizes (H1-H6, SMALL) are not feasible due to Mudlet's
fixed-width rendering architecture
- Tags are recognized to prevent them from displaying as raw text
- HR width respects the profile's word-wrap setting (`mWrapAt`)
- New `TMxpHRTagHandler` injects text through the MXP processing
pipeline to maintain proper line buffering

---------

Co-authored-by: Vadim Peretokin <vperetokin@hey.com>
2025-11-14 14:18:58 +01:00

34 lines
1.7 KiB
C++

/***************************************************************************
* Copyright (C) 2025 by Mike Conley - mike.conley@stickmud.com *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef MUDLET_TMXPHRTAGHANDLER_H
#define MUDLET_TMXPHRTAGHANDLER_H
#include "TMxpTagHandler.h"
class TMxpHRTagHandler : public TMxpSingleTagHandler
{
public:
TMxpHRTagHandler()
: TMxpSingleTagHandler("HR")
{}
TMxpTagHandlerResult handleStartTag(TMxpContext& ctx, TMxpClient& client, MxpStartTag* tag) override;
};
#include "TMxpTagHandler.h"
#endif //MUDLET_TMXPHRTAGHANDLER_H