From 9ec32e26f3dd6a7a8ac65fc4e366b9eb3189a20a Mon Sep 17 00:00:00 2001 From: Rhys Arkins <rhys@arkins.net> Date: Sat, 22 Sep 2018 20:01:18 +0200 Subject: [PATCH] refactor(gitlab): use markdown not html --- lib/platform/gitlab/index.js | 16 +--------------- .../gitlab/__snapshots__/index.spec.js.snap | 2 +- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/lib/platform/gitlab/index.js b/lib/platform/gitlab/index.js index 63efaf6554..e7d8c8ece6 100644 --- a/lib/platform/gitlab/index.js +++ b/lib/platform/gitlab/index.js @@ -1,13 +1,9 @@ const is = require('@sindresorhus/is'); const addrs = require('email-addresses'); -const showdown = require('showdown'); const get = require('./gl-got-wrapper'); const hostRules = require('../../util/host-rules'); -const converter = new showdown.Converter(); -converter.setFlavor('github'); - let config = {}; module.exports = { @@ -727,17 +723,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(/Pull Request/g, 'Merge Request') - .replace(/PR/g, 'MR') - .replace( - `<p><details><br />\n<summary>Release Notes</summary></p>`, - '\n<details>\n\n<summary>Release Notes</summary>\n\n' - ) - .replace('<p></details></p>', '\n</details>\n'); - // TODO: set maximum length + return input.replace(/Pull Request/g, 'Merge Request').replace(/PR/g, 'MR'); } // Generic File operations diff --git a/test/platform/gitlab/__snapshots__/index.spec.js.snap b/test/platform/gitlab/__snapshots__/index.spec.js.snap index da1e9ba0e9..9b4783ef58 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