diff --git a/lib/rules/validate-jsdoc/require-description-complete-sentence.js b/lib/rules/validate-jsdoc/require-description-complete-sentence.js
index f66913b..fa6d8d5 100644
--- a/lib/rules/validate-jsdoc/require-description-complete-sentence.js
+++ b/lib/rules/validate-jsdoc/require-description-complete-sentence.js
@@ -56,6 +56,10 @@ function requireDescriptionCompleteSentence(node, err) {
.replace(/(`)([^`]+)\1/, quotedSanitizer)
.replace(/(')([^']+)\1/, quotedSanitizer)
.replace(/(")([^"]+)\1/, quotedSanitizer)
+ // sanitize HTML tags which close
+ .replace(/<([^ >]+)[^>]*>[\s\S]*?.*?<\/\1>|<[^\/]+\/>/g, htmlSanitizer)
+ // sanitize self-closing HTML tags eg
+ .replace(/<([^ >]+)[^>]*>/g, htmlSanitizer)
.replace(/\{([^}]+)\}/, function(_, m) {
return '{' + (new Array(m.length + 1)).join('*') + '}';
})
@@ -179,3 +183,19 @@ function quotedSanitizer(_, q, m) {
var endsWithDot = /\.\s*$/.test(m);
return q + (new Array(m.length + (endsWithDot ? 0 : 1))).join('*') + q + (endsWithDot ? '.' : '');
}
+
+/**
+ * HTML part sanitizer.
+ * To prevent RE_NEW_LINE_START_WITH_UPPER_CASE
+ * return string will padded by 'x.'
+ *
+ * @private
+ * @param {string} _ - Full matched string
+ * @returns {string} - Sanitized string
+ */
+function htmlSanitizer(_) {
+ return _.split('').map(function(token, iterator) {
+ if (iterator === _.length - 1) { return 'x.'}
+ return token === '\n' ? '\n' : '*';
+ }).join('');
+}
diff --git a/test/lib/rules/validate-jsdoc/require-description-complete-sentence.js b/test/lib/rules/validate-jsdoc/require-description-complete-sentence.js
index 9f8b5d8..0e20f1b 100644
--- a/test/lib/rules/validate-jsdoc/require-description-complete-sentence.js
+++ b/test/lib/rules/validate-jsdoc/require-description-complete-sentence.js
@@ -232,6 +232,28 @@ describe('lib/rules/validate-jsdoc/require-description-complete-sentence', funct
*/
function quux() {}
}
+ }, {
+ it: 'should not report sentences with html tags inside',
+ code: function () {
+ /**
+ * A foo is assigned the boolean value
true
. + */ + function fun(p) {} + } + }, { + it: 'should not report sentences that are html code', + code: function () { + /** + * The html code here + * + *Hello world!
+ * + * Should always be there. + * And the first letter of this line is in + * uppercase. + */ + function fun(p) {} + } } /* jshint ignore:end */ ]);