diff --git a/redstring/server.py b/redstring/server.py
index f4f9513..f6dad93 100644
--- a/redstring/server.py
+++ b/redstring/server.py
@@ -6,6 +6,7 @@ import json
import logging
import os
import random
+import re
import string
from flask import (
@@ -44,6 +45,14 @@ def inject_edit():
return {'edit': current_app.config['edit']}
+@app.template_filter('interlink')
+def interlink_filter(value):
+ return re.sub(
+ r'\[\[([^|]+)\|([^|]+)\]\]',
+ lambda match: f'{match[1]}',
+ value)
+
+
@app.route('/', methods=['GET'])
def root():
return redirect(url_for('index'))
diff --git a/redstring/templates/doc.jinja b/redstring/templates/doc.jinja
index f2d8801..b7549d4 100644
--- a/redstring/templates/doc.jinja
+++ b/redstring/templates/doc.jinja
@@ -63,10 +63,11 @@ window.onload = function () {
{% endmacro %}
-{# TODO: tag.interlink #}
{% macro make_tag_value(tag) -%}
{%- if tag.options.hyperlink -%}
{{ tag.value }}
+{%- elif tag.options.interlink -%}
+{{ tag.value|interlink }}
{%- else -%}
{{ tag.value }}
{%- endif -%}