summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/install/Troubleshooting.md7
-rw-r--r--doc/integrations/webhooks/Incoming-Webhooks.md66
-rw-r--r--docker/1.1/Dockerfile2
-rw-r--r--web/react/components/email_verify.jsx2
-rw-r--r--web/react/components/find_team.jsx1
-rw-r--r--web/react/components/invite_member_modal.jsx3
-rw-r--r--web/react/components/login.jsx2
-rw-r--r--web/react/components/password_reset_form.jsx1
-rw-r--r--web/react/components/password_reset_send_link.jsx1
-rw-r--r--web/react/components/signup_user_complete.jsx3
-rw-r--r--web/react/components/team_signup_display_name_page.jsx1
-rw-r--r--web/react/components/team_signup_email_item.jsx1
-rw-r--r--web/react/components/team_signup_password_page.jsx1
-rw-r--r--web/react/components/team_signup_url_page.jsx1
-rw-r--r--web/react/components/team_signup_username_page.jsx1
-rw-r--r--web/react/components/team_signup_welcome_page.jsx1
-rw-r--r--web/react/components/team_signup_with_email.jsx1
-rw-r--r--web/react/components/team_signup_with_sso.jsx1
-rw-r--r--web/react/utils/markdown.jsx38
-rw-r--r--web/react/utils/text_formatting.jsx9
-rw-r--r--web/react/utils/utils.jsx1
21 files changed, 107 insertions, 37 deletions
diff --git a/doc/install/Troubleshooting.md b/doc/install/Troubleshooting.md
new file mode 100644
index 000000000..8d82100d8
--- /dev/null
+++ b/doc/install/Troubleshooting.md
@@ -0,0 +1,7 @@
+### Mattermost Troubleshooting
+
+#### Important notes
+
+1. **DO NOT manipulate the Mattermost database**
+ - In particular, DO NOT delete data from the database, as this will most likely crash Mattermost in strange ways. Mattermost is designed to archive content continously and generally assumes data is never deleted.
+
diff --git a/doc/integrations/webhooks/Incoming-Webhooks.md b/doc/integrations/webhooks/Incoming-Webhooks.md
index 645d4861e..f01db90a4 100644
--- a/doc/integrations/webhooks/Incoming-Webhooks.md
+++ b/doc/integrations/webhooks/Incoming-Webhooks.md
@@ -1,19 +1,19 @@
# Incoming Webhooks
-Incoming webhooks allow external applications, written in the programming language of your choice--to post messages into Mattermost channels and private groups by sending a specifically formatted JSON payload via HTTP POST request to a secret Mattermost URL generated specifically for each application.
+Incoming webhooks allow external applications, written in the programming language of your choice--to post messages into Mattermost channels and private groups by sending a specifically formatted JSON payload via HTTP POST request to a secret Mattermost URL generated specifically for each application.
-A couple key points:
+A couple key points:
-- **Mattermost incoming webhooks are Slack-compatible.** If you've used Slack's incoming webhooks to create integrations, you can copy and paste that code to create Mattermost integrations. Mattermost automatically translates Slack's propretiary JSON payload format into markdown to render in Mattermost messages.
+- **Mattermost incoming webhooks are Slack-compatible.** If you've used Slack's incoming webhooks to create integrations, you can copy and paste that code to create Mattermost integrations. Mattermost automatically translates Slack's propretiary JSON payload format into markdown to render in Mattermost messages.
- **Mattermost incoming webhooks support full markdown.** A rich range of formatting unavailable in Slack is made possible through [markdown support](../../usage/Markdown.md) in Mattermost, incuding headings, formatted fonts, tables, inline images and other options supported by [Mattermost Markdown].
_Example:_
-Suppose you wanted to create a notification of the status of a daily build, with a table of total tests run and total tests failed by component category, with links to failed tests by category. You could create the following JSON payload to post to a Mattermost channel using webhooks:
+Suppose you wanted to create a notification of the status of a daily build, with a table of total tests run and total tests failed by component category, with links to failed tests by category. You could create the following JSON payload to post to a Mattermost channel using webhooks:
```
payload={"text": "
-***
+***
##### Build Break - Project X - December 12, 2015 - 15:32 GMT +0
| Component | Tests Run | Tests Failed |
|:-----------|:------------|:-----------------------------------------------|
@@ -25,56 +25,68 @@ payload={"text": "
```
Which would render in a Mattermost message as follows:
-***
+***
##### Build Break - Project X - December 12, 2015 - 15:32 GMT +0
| Component | Tests Run | Tests Failed |
|:------------ |:---------------|:-----|
| Server | 948 | :white_check_mark: 0 |
| Web Client | 123 | :warning: [2 (see details)](http://linktologs) |
| iOS Client | 78 | :warning: [3 (see details)](http://linktologs) |
-***
+***
+
+### Enabling Incoming Webhooks
+Incoming webhooks should be enabled on your Mattermost instance by default, but if they are not you'll need to get your system administrator to enable them. If you are the system administrator you can enable them by doing the following:
+
+1. Login to your Mattermost team account that has the system administrator role.
+1. Enable incoming webhooks from **System Console -> Service Settings**.
+1. (Optional) Configure the **Enable Overriding of Usernames from Webhooks** option to allow external applications to post messages under any name. If not enabled, the username of the creator of the webhook URL is used to post messages.
+2. (Optional) Configure the **Enable Overriding of Icon from Webhooks** option to allow external applciations to change the icon of the account posting messages. If not enabled, the icon of the creator of the webhook URL is used to post messages.
+
+### Setting Up Existing Integrations
+If you've already found or built an integration and are just looking to hook it up, then you should just need to follow the specific instructions of that integration. If the integration is using Mattermost incoming webhooks, then at some point in the instructions it will ask for a webhook URL. You can get this URL by following the first step in the next section _Creating Integrations using Incoming Webhooks_.
### Creating Integrations using Incoming Webhooks
-You can create a webhook integration to post into Mattermost channels and private groups using these steps:
+You can create a webhook integration to post into Mattermost channels and private groups using these steps:
-1. Enable incoming webhooks from **System Console -> Service Settings**
+**Note: Incoming webhooks must be enabled. Only your Mattermost system administrator can enable incoming webhooks if they are currently disabled.**
- 1. Optionally configure the **Enable Overriding of Usernames from Webhooks** option to allow external applications to post messages under any name. If not enabled, the username of the creator of the webhook URL is used to post messages.
- 2. Optionally configure the **Enable Overriding of Icon from Webhooks** option to allow external applciations to change the icon of the account posting messages. If not enabled, the icon of the creator of the webhook URL is used to post messages.
-
2. Create a Mattermost Incoming Webhook URL
1. Login to your Mattermost team site and go to **Account Settings -> Integrations**
2. Next to **Incoming Webhooks** click **Edit**
3. Select the channel or private group to receive webhook payloads, then click **Add** to create the webhook
-
-3. Write a function to call the URL with a properly formatted JSON payload
- 1. To make sure everything works, try a curl command from your terminal or command line to send a JSON string as the `payload` parameter in a HTTP POST request.
- - _Example:_
+ 4. To see your new webhook in action, try a curl command from your terminal or command-line to send a JSON string as the `payload` parameter in a HTTP POST request.
+ 1. Example:
```
curl -i -X POST -d 'payload={"text": "Hello, this is some text."}' http://yourmattermost.com/hooks/xxx-generatedkey-xxx
-```
- 2. In addition, with **Enable Overriding of Usernames from Webhooks** turned on, you can also override the username the message posts as by providing a `username` parameter in your JSON payload. For example, you might want your message looking like it came from a robot so you can use ```payload={"username": "robot", "text": "Hello, this is some text."}``` to change the username of the post to robot. Note, to combat any malicious users from trying to use this to perform [phishing attacks](https://en.wikipedia.org/wiki/Phishing) a `BOT` indicator appears next to posts coming from incoming webhooks.
- 3. With **Enable Overriding of Icon from Webhooks** turned on, you can similarly change the icon the message posts with by providing a link to an image in the `icon_url` parameter of your payload. For example, ```payload={"icon_url": "http://somewebsite.com/somecoolimage.jpg", "text": "Hello, this is some text."}``` will post using whatever image is located at `http://somewebsite.com/somecoolimage.jpg` as the icon for the post.
+```
- 2. Set up your integration running on your own machine or a hosting service like AWS or Heroku, to start sending real time updates to Mattermost channels and private groups.
+3. Build your integration in the programming language of your choice
+ 1. Most integrations will be used to translate some sort of output from another system to an appropriately formatted input that will be passed into the Mattermost webhook URL. For example, an integration could take events generated by [GitLab outgoing webhooks](http://doc.gitlab.com/ee/web_hooks/web_hooks.html) and parse them into a JSON body to post into Mattermost.
+ 1. To get the message posted into Mattermost, your integration will need to create an HTTP POST request that will submit to the incoming webhook URL you created before. The body of the request must have a `payload` that contains a JSON object that specifies a `text` parameter. For example, `payload={"text": "Hello, this is some text."}` is a valid body for a request.
+ 2. Setup your integration running on Heroku, an AWS server or a server of your own to start sending real time updates to Mattermost channels and private groups.
Additional Notes:
-1. For the JSON payload, if `Content-Type` is specified as `application/json` in the headers of the HTTP request then the body of the request can be direct JSON. ```{"text": "Hello, this is some text."}```
+1. For the HTTP request body, if `Content-Type` is specified as `application/json` in the headers of the HTTP request then the body of the request can be direct JSON. For example, ```{"text": "Hello, this is some text."}```
+
+2. You can override the channel specified in the webhook definition by specifying a `channel` parameter in your payload. For example, you might have a single webhook created for _Town Square_, but you can use ```payload={"channel": "off-topic", "text": "Hello, this is some text."}``` to send a message to the _Off-Topic_ channel using the same webhook URL.
-2. You can override the channel specified in the webhook definition by specifying a `channel` parameter in your payload. For example, you might have a single webhook created for _Town Square_, but you can use ```payload={"channel": "off-topic", "text": "Hello, this is some text."}``` to send a message to the _Off-Topic_ channel using the same webhook URL.
+1. In addition, with **Enable Overriding of Usernames from Webhooks** turned on, you can also override the username the message posts as by providing a `username` parameter in your JSON payload. For example, you might want your message looking like it came from a robot so you can use ```payload={"username": "robot", "text": "Hello, this is some text."}``` to change the username of the post to robot. Note, to combat any malicious users from trying to use this to perform [phishing attacks](https://en.wikipedia.org/wiki/Phishing) a `BOT` indicator appears next to posts coming from incoming webhooks.
-3. Also, as mentioned previously, [markdown](../../usage/Markdown.md) can be used to create richly formatted payloads, for example: ```payload={"text": "# A Header\nThe _text_ below **the** header."}``` creates a messages with a header, a carriage return and bold text for "the".
+2. With **Enable Overriding of Icon from Webhooks** turned on, you can similarly change the icon the message posts with by providing a link to an image in the `icon_url` parameter of your payload. For example, ```payload={"icon_url": "http://somewebsite.com/somecoolimage.jpg", "text": "Hello, this is some text."}``` will post using whatever image is located at `http://somewebsite.com/somecoolimage.jpg` as the icon for the post.
+
+3. Also, as mentioned previously, [markdown](../../usage/Markdown.md) can be used to create richly formatted payloads, for example: ```payload={"text": "# A Header\nThe _text_ below **the** header."}``` creates a messages with a header, a carriage return and bold text for "the".
4. Just like regular posts, the text will be limited to 4000 characters at maximum.
-### Slack Compatibility
+### Slack Compatibility
-As mentioned above, Mattermost makes it easy to take integrations written for Slack's proprietary JSON payload format and repurpose them to become Mattermost integrations. The following automatic translations are supported:
+As mentioned above, Mattermost makes it easy to take integrations written for Slack's proprietary JSON payload format and repurpose them to become Mattermost integrations. The following automatic translations are supported:
-1. Payloads designed for Slack using `<>` to note the need to hyperlink a URL, such as ```payload={"text": "<http://www.mattermost.com/>"}```, are translated to the equivalent markdown in Mattermost and rendered the same as you would see in Slack.
-2. Similiarly, payloads designed for Slack using `|` within a `<>` to define linked text, such as ```payload={"text": "Click <http://www.mattermost.com/|here> for a link."}```, are also translated to the equivalent markdown in Mattermost and rendered the same as you would see in Slack.
+1. Payloads designed for Slack using `<>` to note the need to hyperlink a URL, such as ```payload={"text": "<http://www.mattermost.com/>"}```, are translated to the equivalent markdown in Mattermost and rendered the same as you would see in Slack.
+2. Similiarly, payloads designed for Slack using `|` within a `<>` to define linked text, such as ```payload={"text": "Click <http://www.mattermost.com/|here> for a link."}```, are also translated to the equivalent markdown in Mattermost and rendered the same as you would see in Slack.
3. Like Slack, by overriding the channel name with an @username, such as payload={"text": "Hi", channel: "@jim"}, you can send the message to a user through your direct message chat.
4. Channel names can be prepended with a #, like they are in Slack incoming webhooks, and the message will still be sent to the correct channel.
To learn more about Incoming Webhooks and to see samples and community contributions, please visit <http://mattermost.org/webhooks>
+
diff --git a/docker/1.1/Dockerfile b/docker/1.1/Dockerfile
index 600d33308..855dd4375 100644
--- a/docker/1.1/Dockerfile
+++ b/docker/1.1/Dockerfile
@@ -34,7 +34,7 @@ VOLUME /var/lib/mysql
WORKDIR /mattermost
# Copy over files
-ADD https://github.com/mattermost/platform/releases/download/v1.1.0-rc1/mattermost.tar.gz /
+ADD https://github.com/mattermost/platform/releases/download/v1.1.0-rc2/mattermost.tar.gz /
RUN tar -zxvf /mattermost.tar.gz --strip-components=1 && rm /mattermost.tar.gz
ADD config_docker.json /
ADD docker-entry.sh /
diff --git a/web/react/components/email_verify.jsx b/web/react/components/email_verify.jsx
index 2b413b848..9be7f97f8 100644
--- a/web/react/components/email_verify.jsx
+++ b/web/react/components/email_verify.jsx
@@ -22,7 +22,7 @@ export default class EmailVerify extends React.Component {
title = global.window.config.SiteName + ' Email Verified';
body = <p>Your email has been verified! Click <a href={this.props.teamURL + '?email=' + this.props.userEmail}>here</a> to log in.</p>;
} else {
- title = global.window.config.SiteName + ' Email Not Verified';
+ title = global.window.config.SiteName + ': You are almost done';
body = <p>Please verify your email address. Check your inbox for an email.</p>;
resend = (
<button
diff --git a/web/react/components/find_team.jsx b/web/react/components/find_team.jsx
index 59c4e08e3..9e3e3a683 100644
--- a/web/react/components/find_team.jsx
+++ b/web/react/components/find_team.jsx
@@ -70,6 +70,7 @@ export default class FindTeam extends React.Component {
className='form-control'
placeholder='you@domain.com'
maxLength='128'
+ spellCheck='false'
/>
{emailError}
</div>
diff --git a/web/react/components/invite_member_modal.jsx b/web/react/components/invite_member_modal.jsx
index 2ca39d1b1..c2f2c15ac 100644
--- a/web/react/components/invite_member_modal.jsx
+++ b/web/react/components/invite_member_modal.jsx
@@ -211,6 +211,7 @@ export default class InviteMemberModal extends React.Component {
placeholder='First name'
maxLength='64'
disabled={!this.state.emailEnabled}
+ spellCheck='false'
/>
{firstNameError}
</div>
@@ -224,6 +225,7 @@ export default class InviteMemberModal extends React.Component {
placeholder='Last name'
maxLength='64'
disabled={!this.state.emailEnabled}
+ spellCheck='false'
/>
{lastNameError}
</div>
@@ -242,6 +244,7 @@ export default class InviteMemberModal extends React.Component {
placeholder='email@domain.com'
maxLength='64'
disabled={!this.state.emailEnabled}
+ spellCheck='false'
/>
{emailError}
</div>
diff --git a/web/react/components/login.jsx b/web/react/components/login.jsx
index 997abce68..f81822e1e 100644
--- a/web/react/components/login.jsx
+++ b/web/react/components/login.jsx
@@ -136,6 +136,7 @@ export default class Login extends React.Component {
defaultValue={priorEmail}
ref='email'
placeholder='Email'
+ spellCheck='false'
/>
</div>
<div className={'form-group' + errorClass}>
@@ -146,6 +147,7 @@ export default class Login extends React.Component {
name='password'
ref='password'
placeholder='Password'
+ spellCheck='false'
/>
</div>
<div className='form-group'>
diff --git a/web/react/components/password_reset_form.jsx b/web/react/components/password_reset_form.jsx
index 0ef187114..6112adbaf 100644
--- a/web/react/components/password_reset_form.jsx
+++ b/web/react/components/password_reset_form.jsx
@@ -69,6 +69,7 @@ export default class PasswordResetForm extends React.Component {
name='password'
ref='password'
placeholder='Password'
+ spellCheck='false'
/>
</div>
{error}
diff --git a/web/react/components/password_reset_send_link.jsx b/web/react/components/password_reset_send_link.jsx
index 78fbcaa2f..f547499b0 100644
--- a/web/react/components/password_reset_send_link.jsx
+++ b/web/react/components/password_reset_send_link.jsx
@@ -73,6 +73,7 @@ export default class PasswordResetSendLink extends React.Component {
name='email'
ref='email'
placeholder='Email'
+ spellCheck='false'
/>
</div>
{error}
diff --git a/web/react/components/signup_user_complete.jsx b/web/react/components/signup_user_complete.jsx
index 8a3af707f..4f48f3dee 100644
--- a/web/react/components/signup_user_complete.jsx
+++ b/web/react/components/signup_user_complete.jsx
@@ -169,6 +169,7 @@ export default class SignupUserComplete extends React.Component {
placeholder=''
maxLength='128'
autoFocus={true}
+ spellCheck='false'
/>
{emailError}
</div>
@@ -204,6 +205,7 @@ export default class SignupUserComplete extends React.Component {
className='form-control'
placeholder=''
maxLength='128'
+ spellCheck='false'
/>
{nameError}
<p className='form__hint'>Username must begin with a letter, and contain between 3 to 15 lowercase characters made up of numbers, letters, and the symbols '.', '-' and '_'</p>
@@ -218,6 +220,7 @@ export default class SignupUserComplete extends React.Component {
className='form-control'
placeholder=''
maxLength='128'
+ spellCheck='false'
/>
{passwordError}
</div>
diff --git a/web/react/components/team_signup_display_name_page.jsx b/web/react/components/team_signup_display_name_page.jsx
index 65da4bc96..c91ed0811 100644
--- a/web/react/components/team_signup_display_name_page.jsx
+++ b/web/react/components/team_signup_display_name_page.jsx
@@ -66,6 +66,7 @@ export default class TeamSignupDisplayNamePage extends React.Component {
defaultValue={this.props.state.team.display_name}
autoFocus={true}
onFocus={this.handleFocus}
+ spellCheck='false'
/>
</div>
</div>
diff --git a/web/react/components/team_signup_email_item.jsx b/web/react/components/team_signup_email_item.jsx
index 219f14eef..7253e80e9 100644
--- a/web/react/components/team_signup_email_item.jsx
+++ b/web/react/components/team_signup_email_item.jsx
@@ -51,6 +51,7 @@ export default class TeamSignupEmailItem extends React.Component {
placeholder='Email Address'
defaultValue={this.props.email}
maxLength='128'
+ spellCheck='false'
/>
{emailError}
</div>
diff --git a/web/react/components/team_signup_password_page.jsx b/web/react/components/team_signup_password_page.jsx
index dce8105ca..01f961332 100644
--- a/web/react/components/team_signup_password_page.jsx
+++ b/web/react/components/team_signup_password_page.jsx
@@ -109,6 +109,7 @@ export default class TeamSignupPasswordPage extends React.Component {
className='form-control'
placeholder=''
maxLength='128'
+ spellCheck='false'
/>
<div className='color--light form__hint'>Passwords must contain 5 to 50 characters. Your password will be strongest if it contains a mix of symbols, numbers, and upper and lowercase characters.</div>
</div>
diff --git a/web/react/components/team_signup_url_page.jsx b/web/react/components/team_signup_url_page.jsx
index 398a52f7d..3fb0aaa27 100644
--- a/web/react/components/team_signup_url_page.jsx
+++ b/web/react/components/team_signup_url_page.jsx
@@ -111,6 +111,7 @@ export default class TeamSignupUrlPage extends React.Component {
defaultValue={this.props.state.team.name}
autoFocus={true}
onFocus={this.handleFocus}
+ spellCheck='false'
/>
</div>
</div>
diff --git a/web/react/components/team_signup_username_page.jsx b/web/react/components/team_signup_username_page.jsx
index 53a389c4c..85e611481 100644
--- a/web/react/components/team_signup_username_page.jsx
+++ b/web/react/components/team_signup_username_page.jsx
@@ -68,6 +68,7 @@ export default class TeamSignupUsernamePage extends React.Component {
placeholder=''
defaultValue={this.props.state.user.username}
maxLength='128'
+ spellCheck='false'
/>
<div className='color--light form__hint'>Usernames must begin with a letter and contain 3 to 15 characters made up of lowercase letters, numbers, and the symbols '.', '-' and '_'</div>
</div>
diff --git a/web/react/components/team_signup_welcome_page.jsx b/web/react/components/team_signup_welcome_page.jsx
index 78a41eed5..2d7ef081f 100644
--- a/web/react/components/team_signup_welcome_page.jsx
+++ b/web/react/components/team_signup_welcome_page.jsx
@@ -145,6 +145,7 @@ export default class TeamSignupWelcomePage extends React.Component {
className='form-control'
placeholder='Email Address'
maxLength='128'
+ spellCheck='false'
/>
</div>
</div>
diff --git a/web/react/components/team_signup_with_email.jsx b/web/react/components/team_signup_with_email.jsx
index 9376a4564..ba32a9f97 100644
--- a/web/react/components/team_signup_with_email.jsx
+++ b/web/react/components/team_signup_with_email.jsx
@@ -63,6 +63,7 @@ export default class EmailSignUpPage extends React.Component {
className='form-control'
placeholder='Email Address'
maxLength='128'
+ spellCheck='false'
/>
</div>
<div className='form-group'>
diff --git a/web/react/components/team_signup_with_sso.jsx b/web/react/components/team_signup_with_sso.jsx
index 011bfebff..6ccf762c1 100644
--- a/web/react/components/team_signup_with_sso.jsx
+++ b/web/react/components/team_signup_with_sso.jsx
@@ -104,6 +104,7 @@ export default class SSOSignUpPage extends React.Component {
placeholder='Enter name of new team'
maxLength='128'
onChange={this.nameChange}
+ spellCheck='false'
/>
{nameError}
</div>
diff --git a/web/react/utils/markdown.jsx b/web/react/utils/markdown.jsx
index 12d6dd424..848b1ea75 100644
--- a/web/react/utils/markdown.jsx
+++ b/web/react/utils/markdown.jsx
@@ -6,7 +6,31 @@ const Utils = require('./utils.jsx');
const marked = require('marked');
-export class MattermostMarkdownRenderer extends marked.Renderer {
+class MattermostInlineLexer extends marked.InlineLexer {
+ constructor(links, options) {
+ super(links, options);
+
+ // modified version of the regex that doesn't break up words in snake_case
+ // the original is /^[\s\S]+?(?=[\\<!\[_*`]| {2,}\n|$)/
+ this.rules.text = /^[\s\S]+?(?=__|\b_|[\\<!\[*`]| {2,}\n|$)/;
+ }
+}
+
+class MattermostParser extends marked.Parser {
+ parse(src) {
+ this.inline = new MattermostInlineLexer(src.links, this.options, this.renderer);
+ this.tokens = src.reverse();
+
+ var out = '';
+ while (this.next()) {
+ out += this.tok();
+ }
+
+ return out;
+ }
+}
+
+class MattermostMarkdownRenderer extends marked.Renderer {
constructor(options, formattingOptions = {}) {
super(options);
@@ -68,3 +92,15 @@ export class MattermostMarkdownRenderer extends marked.Renderer {
return TextFormatting.doFormatText(text, this.formattingOptions);
}
}
+
+export function format(text, options) {
+ const markdownOptions = {
+ renderer: new MattermostMarkdownRenderer(null, options),
+ sanitize: true
+ };
+
+ const tokens = marked.lexer(text, markdownOptions);
+
+ return new MattermostParser(markdownOptions).parse(tokens);
+}
+
diff --git a/web/react/utils/text_formatting.jsx b/web/react/utils/text_formatting.jsx
index 2b6e6e14e..6778d341a 100644
--- a/web/react/utils/text_formatting.jsx
+++ b/web/react/utils/text_formatting.jsx
@@ -8,8 +8,6 @@ const Markdown = require('./markdown.jsx');
const UserStore = require('../stores/user_store.jsx');
const Utils = require('./utils.jsx');
-const marked = require('marked');
-
// Performs formatting of user posts including highlighting mentions and search terms and converting urls, hashtags, and
// @mentions to links by taking a user's message and returning a string of formatted html. Also takes a number of options
// as part of the second parameter:
@@ -22,11 +20,8 @@ export function formatText(text, options = {}) {
let output;
if (!('markdown' in options) || options.markdown) {
- // the markdown renderer will call doFormatText as necessary so just call marked
- output = marked(text, {
- renderer: new Markdown.MattermostMarkdownRenderer(null, options),
- sanitize: true
- });
+ // the markdown renderer will call doFormatText as necessary
+ output = Markdown.format(text, options);
} else {
output = sanitizeHtml(text);
output = doFormatText(output, options);
diff --git a/web/react/utils/utils.jsx b/web/react/utils/utils.jsx
index 6a5188974..91502352e 100644
--- a/web/react/utils/utils.jsx
+++ b/web/react/utils/utils.jsx
@@ -508,6 +508,7 @@ export function applyTheme(theme) {
changeCss('.post:hover, .modal .more-channel-table tbody>tr:hover td, .sidebar--right .sidebar--right__header, .settings-modal .settings-table .settings-content .section-min:hover', 'background:' + changeOpacity(theme.centerChannelColor, 0.07), 1);
changeCss('.date-separator.hovered--before:after, .date-separator.hovered--after:before, .new-separator.hovered--after:before, .new-separator.hovered--before:after', 'background:' + changeOpacity(theme.centerChannelColor, 0.07), 1);
changeCss('.command-name:hover, .mentions-name:hover, .mentions-focus, .dropdown-menu>li>a:focus, .dropdown-menu>li>a:hover', 'background:' + changeOpacity(theme.centerChannelColor, 0.15), 1);
+ changeCss('code', 'background:' + changeOpacity(theme.centerChannelColor, 0.1), 1);
changeCss('.post.current--user:hover .post-body ', 'background: none;', 1);
changeCss('.sidebar--right', 'color:' + theme.centerChannelColor, 2);
}