From 1892b90348f94bf827c48496e9c003bfbd285f19 Mon Sep 17 00:00:00 2001 From: Rhys Arkins <rhys@arkins.net> Date: Sun, 22 Jul 2018 21:58:10 +0200 Subject: [PATCH] feat(gitlab): use markdown for pr bodies --- lib/platform/gitlab/index.js | 14 +------------- .../gitlab/__snapshots__/index.spec.js.snap | 2 +- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/lib/platform/gitlab/index.js b/lib/platform/gitlab/index.js index 859e3bcfcf..33659f6e62 100644 --- a/lib/platform/gitlab/index.js +++ b/lib/platform/gitlab/index.js @@ -1,12 +1,8 @@ const is = require('@sindresorhus/is'); const addrs = require('email-addresses'); -const showdown = require('showdown'); const get = require('./gl-got-wrapper'); const endpoints = require('../../util/endpoints'); -const converter = new showdown.Converter(); -converter.setFlavor('github'); - let config = {}; module.exports = { @@ -704,15 +700,7 @@ async function mergePr(iid) { function getPrBody(input) { // Convert to HTML using GitHub-flavoured markdown as it is more feature-rich than GitLab's flavour - return converter - .makeHtml(input) - .replace(/<\/?h4[^>]*>/g, '**') // See #954 - .replace(/Pull Request/g, 'Merge Request') - .replace(/PR/g, 'MR') - .replace(/<summary>/g, '<h1>') - .replace(/<\/summary><\/p>/g, '</h1>') - .replace(/<p><details><br \/>\n/g, '') - .replace(/<p><\/details><\/p>\n/g, ''); + return input.replace(/Pull Request/g, 'Merge Request').replace(/PR/g, 'MR'); // TODO: set maximum length } diff --git a/test/platform/gitlab/__snapshots__/index.spec.js.snap b/test/platform/gitlab/__snapshots__/index.spec.js.snap index 972298c3ac..e448249ddd 100644 --- a/test/platform/gitlab/__snapshots__/index.spec.js.snap +++ b/test/platform/gitlab/__snapshots__/index.spec.js.snap @@ -243,7 +243,7 @@ Object { } `; -exports[`platform/gitlab getPrBody(input) returns updated pr body 1`] = `"<p><a href=\\"https://github.com/foo/bar/issues/5\\">https://github.com/foo/bar/issues/5</a> plus also <a href=\\"https://github.com/foo/bar/issues/5\\">a link</a></p>"`; +exports[`platform/gitlab getPrBody(input) returns updated pr body 1`] = `"https://github.com/foo/bar/issues/5 plus also [a link](https://github.com/foo/bar/issues/5)"`; exports[`platform/gitlab getPrFiles() returns files 1`] = ` Array [ -- GitLab