Welcome to mirror list, hosted at ThFree Co, Russian Federation.

formatter.js « services « static_site_editor « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 92d5e8a5df8cbabf213b8cb7a9e7b16cfda80742 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
const removeOrphanedBrTags = source => {
  /* Until the underlying Squire editor of Toast UI Editor resolves duplicate `<br>` tags, this
    `replace` solution will clear out orphaned `<br>` tags that it generates. Additionally,
    it cleans up orphaned `<br>` tags in the source markdown document that should be new lines.
    https://gitlab.com/gitlab-org/gitlab/-/issues/227602#note_380765330
  */
  return source.replace(/\n^<br>$/gm, '');
};

const format = source => {
  return removeOrphanedBrTags(source);
};

export default format;