summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2022-12-03 08:29:30 +0100
committerMartin Fischer <martin@push-f.com>2022-12-03 08:29:30 +0100
commitb4ac728a4adf513f69617b80b52284ba10e2ddf8 (patch)
treec1af74254c4d4a756e37aba0122d52fa2689d10d /README.md
parentc3c56543c6febe8fd4c66dda5551abe965efff7f (diff)
document example configuration in README
Diffstat (limited to 'README.md')
-rw-r--r--README.md23
1 files changed, 22 insertions, 1 deletions
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.