<commit_before># Format Link for Chrome

## Why do I need it?
To format the link of the active tab instantly to use in Markdown, reST, HTML, Text, Textile or other formats.

## How to use

### toolbar button
Press the toolbar button of "Format Link".  When a popup opens, texts are automatically copied to the clipboard.

Also you can change the format with selecting the format in the dropdown list. And if you press the "Save as Default" button, you can make it as default.

### context menu
Open the context menu "Format Link", and select one of sub menus for the format you would like to use to copy the URL.

### keyboard shortcut
Press the shortcut key Alt+C to copy the URL in the default format.
If you selected some text, the selected text is used instead of the page title.

## Flexible settings
You can modify formats in [Tools] -> [Extensions] -> Clik "Options" link in "Format Link" Extension.
In format settings, you can use the mini template language.

* variable reference: {{variable}}
    * variable = title / url / text
    * The value of variable `title` is the HTML page title.
    * The value of variable `text` is determined as below:
         * If some text is selected, the selected text is used.
         * If you open the context menu over a link, this extension search the entire document
           for a link whose URL is the same as the link you selected, and uses the text of the link found.
           Note: If there is another link of the same URL, this is not what you want, but this is
           best I can do for now.
         * Otherwise, the page URL is used.
    * The value of the variable `url` is the link URL if selection contains only a link AND
      you initiate a copy with a context menu.
      Otherwise, the value of variable `url` is the HTML page URL.
         * Note it is always the HTML page URL if you use the toolbar button or the
           keyboard shortcut to copy.
           This behavior will be changed if I find a way to get a link URL in selection
           when a toolbar button or a shortcut key is pressed.
    * No spaces are allowed between variable name and braces.
* string substitution: {{variable.s("foo","bar")}}
    * Which means variable.replace(new RegExp("foo", 'g'), "bar")
    * You can use escape character \ in strings.
    * You must escape the first argument for string and regexp.
      For example, .s("\\[","\\[") means replacing [ with \\[
    * You can chain multiple .s("foo","bar")
* You can use the escape character \
* Other characters are treated as literal strings.

Here are examples:

* Markdown

```
[{{text.s("\\[","\\[").s("\\]","\\]")}}]({{url.s("\\)","%29")}})
```

* reST<commit_msg>Update README for 2.0.0<commit_after># Format Link for Chrome

## Why do I need it?
To format the link of the active tab instantly to use in Markdown, reST, HTML, Text, Textile or other formats.

## How to use

The UI changed dramatically in the version 2.0.0.

Now you can use only the context menu to copy the URL.

1. When you open the menu over a link, the link title and the link URL are copied.
    * However, due to the WebExtensions API limitation, the text is taken from the first link of the same URL in the page,
       so it may be different from what you want.
2. When you select the text and open the menu over a link, the selected text and the link URL are copied.
    * Note you can select the text and move the mouse cursor to a link which is outside of the selection.
3. When you open the menu somewhere not over a link, you can copy the page URL.
    * The text becomes the selected text if you selected some text, it becomes the page title otherwise.

The previous version has multiple context menu items for each format to copy.
The version 2.0.0 has only one context menu item.
This change was made to copy a link in shorter steps.

You can select the format with the radio button on the popup of the toolbar button.
When you select the radio button, it becomes the default format.
The "Set as default" button in the previous version was deleted.

Sorry for inconvenience with this major UI changes,
but I believe this version 2.0.0 is simpler and easier to use.
I hope you are accustomed to the new UI soon!

* variable reference: {{variable}}
    * variable = title / url / text
    * The value of variable `title` is the HTML page title.
    * The value of variable `text` is determined as below:
         * If some text is selected, the selected text is used.
         * If you open the context menu over a link, this extension search the entire document
           for a link whose URL is the same as the link you selected, and uses the text of the link found.
           Note: If there is another link of the same URL, this is not what you want, but this is
           best I can do for now.
         * Otherwise, the page URL is used.
    * The value of the variable `url` is the link URL if selection contains only a link.
      Otherwise, the value of variable `url` is the HTML page URL.
    * No spaces are allowed between variable name and braces.
* string substitution: {{variable.s("foo","bar")}}
    * Which means variable.replace(new RegExp("foo", 'g'), "bar")
    * You can use escape character \ in strings.
    * You must escape the first argument for string and regexp.
      For example, .s("\\[","\\[") means replacing [ with \\[
    * You can chain multiple .s("foo","bar")
* You can use the escape character \
* Other characters are treated as literal strings.

Here are examples:

* Markdown

```
[{{text.s("\\[","\\[").s("\\]","\\]")}}]({{url.s("\\)","%29")}})
```

* reST
{'fraction_non_alphanumeric': 0.08055605061486366, 'fraction_numerical': 0.0033862056674389593, 'mean_word_length': 3.051985559566787, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3121150', 'n_tokens_mistral': 1487, 'n_tokens_neox': 1445, 'n_words': 891}