]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blob - doc/todo/Don__39__t_change_text_like___91____91__this__93____93___in_code_blocks.mdwn
Add ikistrap plugin for ikistrap theme.
[git.ikiwiki.info.git] / doc / todo / Don__39__t_change_text_like___91____91__this__93____93___in_code_blocks.mdwn
1     diff --git a/IkiWiki/Plugin/link.pm b/IkiWiki/Plugin/link.pm
2     index 1ba28eafd..61a397bf8 100644
3     --- a/IkiWiki/Plugin/link.pm
4     +++ b/IkiWiki/Plugin/link.pm
5     @@ -107,7 +107,13 @@ sub linkify (@) {
6         my $page=$params{page};
7         my $destpage=$params{destpage};
8      
9     -   $params{content} =~ s{(\\?)$link_regexp}{
10     +    my $content;
11     +    for my $line ( split /\n/, $params{content} ) {
12     +        if ( $line =~ /^(?:\t|    )/ ) {
13     +            $content .= $line . "\n";
14     +            next;
15     +        }
16     +        $line =~ s{(\\?)$link_regexp}{
17                  defined $2
18                      ? ( $1
19                          ? "[[$2|$3".(defined $4 ? "#$4" : "")."]]"
20     @@ -122,8 +128,10 @@ sub linkify (@) {
21                              : htmllink($page, $destpage, linkpage($3),
22                                  anchor => $4))
23                  }eg;
24     +        $content .= $line . "\n";
25     +    }
26      
27     -   return $params{content};
28     +   return $content;
29      }
30      
31      sub scan (@) {
33 Related to [[bugs/wiki links still processed inside code blocks]] and [[forum/How_to_format___91____91__foobar__93____93___in_code_blocks__63__]].
35 [[!tag patch]]
37 > It looks as though this patch would break linkification in any syntactic construct that
38 > uses indentation but isn't a code block, for instance a list:
39 >
40 >     * This is a list
41 >         * So is this
42 >             * And \[[this is a link|http://example.com]]
43 >
44 > rendered as:
45 >
46 > * This is a list
47 >     * So is this
48 >         * And [[this is a link|http://example.com]]
49 >
50 > It's also assuming that Markdown is the only language available (trying to use Markdown
51 > rules), and even in Markdown it doesn't support Github-style fenced code blocks if enabled.
52 >
53 > This is not something that can be done correctly by just patching the link plugin.
54 > I'm not sure whether it's something that can be done correctly at all, unfortunately.
55 >
56 > [[!tag reviewed]] --[[smcv]]