Move over wiki documentation to repo in Markdown format (#1760)

* Change in-client regex help link to point to the github repository
This commit is contained in:
Mm2PL 2020-07-04 13:40:13 +02:00 committed by GitHub
parent ac0546185d
commit 0f9a612c55
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 89 additions and 3 deletions

20
docs/Commands.md Normal file
View file

@ -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.

View file

@ -1 +1,21 @@
# Documents # 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)

45
docs/Regex.md Normal file
View file

@ -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).

View file

@ -95,9 +95,10 @@ void EditableModelView::addCustomButton(QWidget *widget)
void EditableModelView::addRegexHelpLink() void EditableModelView::addRegexHelpLink()
{ {
auto regexHelpLabel = auto regexHelpLabel = new QLabel(
new QLabel("<a href='https://chatterino.com/help/regex'><span " "<a href='"
"style='color:#99f'>regex info</span></a>"); "https://github.com/Chatterino/chatterino2/blob/master/docs/Regex.md'>"
"<span style='color:#99f'>regex info</span></a>");
regexHelpLabel->setOpenExternalLinks(true); regexHelpLabel->setOpenExternalLinks(true);
this->addCustomButton(regexHelpLabel); this->addCustomButton(regexHelpLabel);
} }