README.md 2.02 KB
Newer Older
Alberto Fanjul's avatar
Alberto Fanjul committed
1 2 3 4 5 6 7 8 9 10
# TextViewHyperlinks

![screenshot](screenshot.png)

## Intro

A port in vala to https://gitlab.gnome.org/GNOME/gtk/blob/gtk-3-24/demos/gtk-demo/hypertext.c

## Compiling

11 12 13
        meson build
        ninja -C build
        ./build/TextViewHyperLinks
14

15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
## Options:

```
  TextViewHyperLinks [OPTION]

Help Options:
  -h, --help                                Show help options
  --help-all                                Show all help options
  --help-gapplication                       Show GApplication options
  --help-gtk                                Show GTK+ Options

Application Options:
  --text=TEXT                               Text to parse for urls
  --link-color=COLOR                        Color name or #rgb for links
  --custom-link=REGEX,REPLACEMENT,COLOR     Pattern to transform custom links
30 31
  --config-file=PATH                        Custom path for config file
  --display=DISPLAY                         X display to use
32 33 34
```

## Running
35

Alberto Fanjul's avatar
Alberto Fanjul committed
36
    ./build/TextViewHyperLinks  --custom-link '!([0-9]+),https://gitlab.gnome.org/GNOME/gitg/merge_requests/\1,orange' --custom-link '#([0-9]+),https://gitlab.gnome.org/GNOME/gitg/issues/\1,green' --text 'this is a text with an url https://gitlab.gnome.org/GNOME/gitg/issues/152 and a hidden link #152 and hidden MR !21 and documentation http://example.com/doc?param=1&chapter=4 for sure' --link-color "#0000ee"
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54

You can add config to a ini file (`.git/config` would be the most obvious one) but `custom.ini` on current dir is the default

```
[custom-link "issues"]
   regexp=!([0-9]+)
   replacement=https://gitlab.gnome.org/GNOME/gitg/merge_requests/\\1
   color = orange
[custom-link "merge.request"]
   regexp=#([0-9]+)
   replacement=https://gitlab.gnome.org/GNOME/gitg/merge_requests/\\1
   color = green
[textviewhyperlinks]
   color = #0000ee
```

and run same example as:

Alberto Fanjul's avatar
Alberto Fanjul committed
55
    ./build/TextViewHyperLinks --text 'this is a text with an url https://gitlab.gnome.org/GNOME/gitg/issues/152 and a hidden link #152 and hidden MR !21 and documentation http://example.com/doc?param=1&chapter=4 for sure'
56