From b4ac728a4adf513f69617b80b52284ba10e2ddf8 Mon Sep 17 00:00:00 2001 From: Martin Fischer Date: Sat, 3 Dec 2022 08:29:30 +0100 Subject: document example configuration in README --- README.md | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'README.md') diff --git a/README.md b/README.md index 9370d1f..1486f54 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,28 @@ to provide the following (all in a configurable manner): e.g. automatically higlight pages with names ending in `.rq` as SPARQL (and also display the code actions for them) -Note that code actions are also linkable from other pages via the +## Example configuration + +```php +$wgCode_namespacesWithCodePages[NS_MAIN] = true; + +$wgCode_languages[] = [ + 'tag' => 'query', + 'pygmentsLexer' => 'sparql', + 'actions' => [ + 'run' => 'https://query.wikidata.org/#$code', + 'embed' => 'https://query.wikidata.org/embed.html#$code', + ], + 'linkifiers' => [ + '/\\b[QP][0-9]+\\b/' => 'https://www.wikidata.org/entity/$1', + ], + 'suffix' => '.rq', +]; +``` + +## Linking code actions + +Code actions can be linked from other pages via the `Special:CodeAction` special page, e.g. `Special:CodeAction/run/Example.rq` attempts to execute the `run` action for the `Example.rq` code page and redirect the user accordingly. -- cgit v1.2.3