diff --git a/src/components/postElements/body/view/postBodyView.js b/src/components/postElements/body/view/postBodyView.js
index 3c843cb1e..f07f65b44 100644
--- a/src/components/postElements/body/view/postBodyView.js
+++ b/src/components/postElements/body/view/postBodyView.js
@@ -4,6 +4,7 @@ import { withNavigation } from 'react-navigation';
import { injectIntl } from 'react-intl';
import HTML from 'react-native-html-renderer';
+import { getParentsTagsRecursively } from 'react-native-html-renderer/src/HTMLUtils';
// Styles
import styles from './postBodyStyles';
@@ -159,6 +160,12 @@ class PostBody extends PureComponent {
}
};
+ _alterData = (node) => {
+ if (node.type === 'text' && node.data.includes('markdown-author-link') && node.parent && getParentsTagsRecursively(node.parent).includes('code')) {
+ return node.data.replace(/<[^>]*>/g, '');
+ }
+ }
+
render() {
const { body, isComment } = this.props;
const _initialDimensions = isComment
@@ -181,6 +188,7 @@ class PostBody extends PureComponent {
baseFontStyle={styles.text}
imagesMaxWidth={isComment ? WIDTH - 50 : WIDTH}
alterNode={e => this._alterNode(e, isComment)}
+ alterData={e => this._alterData(e)}
/>
);
diff --git a/src/utils/markdownToHtml.js b/src/utils/markdownToHtml.js
index 539ba2f8a..9304f1158 100644
--- a/src/utils/markdownToHtml.js
+++ b/src/utils/markdownToHtml.js
@@ -98,7 +98,7 @@ export const markDown2Html = (input) => {
const replaceAuthorNames = input => input.replace(authorNameRegex, (match, preceeding1, preceeding2, user) => {
const userLower = user.toLowerCase();
const preceedings = (preceeding1 || '') + (preceeding2 || '');
- return `${preceedings} @${user}`;
+ return `${preceedings}@${user}`;
});
const replaceTags = input => input.replace(tagsRegex, (tag) => {