diff --git a/docs/Commands.md b/docs/Commands.md new file mode 100644 index 000000000..ceaebb831 --- /dev/null +++ b/docs/Commands.md @@ -0,0 +1,20 @@ +Commands are used as shortcuts for long messages. If a message starts with the "trigger" then the message will be replaced with the Command. + +#### Example +Add Command `Hello chat :)` with the trigger `/hello`. Now typing `/hello` in chat will send `Hello chat :)` instead of `/hello`. + +## Advanced + +- The trigger has to be matched at the **start** of the message but there is a setting to also match them at the **end**. +- Triggers don't need to start with `/` + +#### Using placeholders +- `{1}`, `{2}`, `{3}` and so on can be used to insert the 1st, 2nd, 3rd, ... word after the trigger. + + Example: Add Command `/timeout {1} 1` with trigger `/warn`. Now typing `/warn user123` will send `/timeout user123 1` + +- Similarly `{1+}` and so on can be used to insert all words starting with the 1st, ... word. + + Example: Add Command `Have a {1+} day!` with trigger `/day`. Now typing `/day very super nice` will send `Have a very super nice day!` + +- You can use `{{1}` if you want to send `{1}` literally. \ No newline at end of file diff --git a/docs/README.md b/docs/README.md index 57a48fe0f..5ae4760f8 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1 +1,21 @@ # Documents + +Welcome to the Chatterino2 documentation! + +Table of contents: + - [Environment variables](ENV.md) + - [Commands](Commands.md) + - [Regex](Regex.md) + - [Notes](notes/README.md) + - [TCaccountmanager](notes/TCaccountmanager.md) + - [TCappearanceSettings.md](notes/TCappearanceSettings.md) + - [TCchannelNavigation.md](notes/TCchannelNavigation.md) + - [TCchatterinoFeatures.md](notes/TCchatterinoFeatures.md) + - [TCchatting.md](notes/TCchatting.md) + - [TCchatWindowNavigation.md](notes/TCchatWindowNavigation.md) + - [TCemotes.md](notes/TCemotes.md) + - [TCgeneral.md](notes/TCgeneral.md) + - [TChighlighting.md](notes/TChighlighting.md) + - [TCtabsAndSplits.md](notes/TCtabsAndSplits.md) + - [TCusernameTabbing.md](notes/TCusernameTabbing.md) + diff --git a/docs/Regex.md b/docs/Regex.md new file mode 100644 index 000000000..9ef784a5c --- /dev/null +++ b/docs/Regex.md @@ -0,0 +1,45 @@ +_Regular expressions_ (or short _regexes_) are often used to check if a text matches a certain pattern. For example the regex `ab?c` would match `abc` or `ac`, but not `abbc` or `123`. In Chatterino, you can use them to highlight messages (and more) based on complex conditions. + +Basic patterns: + +|Pattern |Matches| +|-|-| +|`x?` |nothing or `x`| +|`x*` |`x`, repeated any number of times| +|`x+` |`x`, repeated any number of times but at least 1| +|`^` |The start of the text| +|`$` |The end of the text| +|`x\|y` |`x` or `y`| + +You can group multiple statements with `()`: + +|Pattern |Matches| +|-|-| +|`asd?` |`asd` or `as`| +|`(asd)?` |`asd` or nothing| +|`\(asd\)` |`(asd)`, literally| + +You can also group multiple characters with `[]`: + +|Pattern |Matches| +|-|-| +|`[xyz]` |`x`, `y` or `z`| +|`[1-5a-f]` |`1`,`2`,`3`,`4`,`5`,`a`,`b`,`c`,`d`,`e`,`f`| +|`[^abc]` |Anything, **except** `a`, `b` and `c`| +|`[\-]` |`-`, literally (escaped with `\`)| +|`\[xyz\]` |`[xyz]`, literally| + +Special patterns: + +|Pattern |Matches| +|-|-| +|`\d` |Digit characters (0-9)| +|`\D` |Non-digit characters| +|`\w` |Word characters (a-zA-Z0-9_)| +|`\W` |Non-word characters| +|`\s` |Spaces, tabs, etc.| +|`\S` |Not spaces, tabs, etc.| +|`\b` |Word boundaries (between \w and \W)| +|`\B` |Non-word boundaries| + +You can try out your regex pattern on websites like [https://regex101.com/](regex101.com). \ No newline at end of file diff --git a/src/widgets/helper/EditableModelView.cpp b/src/widgets/helper/EditableModelView.cpp index 62f1e4dcc..0a2d0dbcb 100644 --- a/src/widgets/helper/EditableModelView.cpp +++ b/src/widgets/helper/EditableModelView.cpp @@ -95,9 +95,10 @@ void EditableModelView::addCustomButton(QWidget *widget) void EditableModelView::addRegexHelpLink() { - auto regexHelpLabel = - new QLabel("regex info"); + auto regexHelpLabel = new QLabel( + "" + "regex info"); regexHelpLabel->setOpenExternalLinks(true); this->addCustomButton(regexHelpLabel); }