Skip to content

Revert strong regex changes from #644 for legacy IAB implementation (#688)#690

Open
Crozzers wants to merge 1 commit intotrentm:masterfrom
Crozzers:restore-original-iab-implementation-behaviour
Open

Revert strong regex changes from #644 for legacy IAB implementation (#688)#690
Crozzers wants to merge 1 commit intotrentm:masterfrom
Crozzers:restore-original-iab-implementation-behaviour

Conversation

@Crozzers
Copy link
Contributor

This PR addresses #688, which is due to the changed rules around strong/em introduced in #665.
In that PR, alot of previously valid strong/em examples became invalid.

In theory, users could do the following to restore the existing behaviour:

class ForceOldIAB(markdown2.ItalicAndBoldProcessor):
    name = 'force-old-iab'
    order = (markdown2.Stage.ITALIC_AND_BOLD,), (markdown2.Stage.ITALIC_AND_BOLD,)

    def sub(self, match):
        syntax = match.group(1)
        tag = 'strong' if len(syntax) == 2 else 'em'
        return f'<{tag}>{match.group(2)}</{tag}>'

ForceOldIAB.register()

markdown2.markdown(text, extras=['force-old-iab']

But #644 changed the strong regex before being superseded by #665 in the same release cycle.

Since that change was never actually released, it may make sense to revert it so that users can opt back into the old IAB behaviour for compatibility

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant