Warning: This recipe isn't tested yet. Somebody please try it out and either report errors here, or (even better) fix things and remove the warning :-)
Is there a way to simply suppress unknown markup, instead of having it display?
I have imported pages from elsewhere and don't have (nor need) all the markups that are used on these pages.
Alternatively: I have written pages that use some special markup, and others might want to import those pages but don't want to install the markup.
If the original site is up and running, and has
$EnableDiag set, you can see the markup that's defined there by doing
http://other.site/path/to/wiki?action=diag. Search for the MarkupTable array and look for the markups that you don't support, then define the appropriate replacement.
Say the original entry is
[include] => Array ( [cmd] => >if [seq] => B>=> [pat] => /\(:(include\s+.+?):\)/ei [rep] => PRR().IncludeText(
$pagename,'$1') [dep] => Array ( [nogroupheader] => > [nogroupfooter] => > ) )
Markup('include', '>if', '/' . pcre_quote ('\(:(include\s+.+?):\)', '/') . '/ei', '');
This will overwrite the definition for the markup.
If you want an error message instead of simply dropping the markup, you can replace the final line with
'\'[Unknown markup: \' . PSS($0) . \']\'');
If you have a general pattern that you wish to ignore, put it into the second line. For example, many markups are written as
(:...:); these can be recognized using
Markup('(:', '<restore', '/\\(:.*?:\\)/', '');
'<restore' makes sure that the rule is processed late, when all the normal markup is already done, so all the remaining
(:...:) get caught by this rule.