Skip to content
Snippets Groups Projects
Commit 9ec32e26 authored by Rhys Arkins's avatar Rhys Arkins
Browse files

refactor(gitlab): use markdown not html

parent b3559e73
No related branches found
Tags 37.184.0
No related merge requests found
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
......
......@@ -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 [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment