Skip to content
This repository was archived by the owner on May 2, 2018. It is now read-only.
This repository was archived by the owner on May 2, 2018. It is now read-only.

How should tag coloring be done #9

@lassik

Description

@lassik

Currently bbcode-mode only colors matching pairs of opening/closing tags. It doesn't color orphaned opening or closing tags at all (i.e. an opening tag without a matching closing tag or vice versa). This can be quite confusing to newcomers since the behavior is different from popular Emacs modes like xml-mode, html-mode and web-mode, all of which color orphaned tags as well as properly paired ones. (xml-mode goes a step further and colors orphaned closing tags in red to highlight that there's a syntax error, but that's tricky to do.)

As a related issue, bbcode-mode tries to implement tag pair matching using a regexp. This does not work properly with nested tags - in particular, nested [quote]s are problematic. It's very difficult if not impossible to properly parse nested structures using regexps.

In light of these points, I'd like to propose that the font-lock patterns should simply match individual opening/closing tags and not worry about pairing them up. This would make bbcode-modes font-lock behavior consistent with existing popular markup modes and would make the font-lock patterns much simpler to implement as well. What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions