Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How can get ride of Line Separator Character in Code snippets

Sedeq Yazdi June 24, 2022

When someone post a code in issue (for example technical part) and she/he use Mac the code may contain Line Separator unicode character (U+2028 : LINE SEPARATOR) that seems not correct!

LineSeparatorCharacter.png

How can I get ride of those? is there any fix for that?

2 answers

0 votes
Sedeq Yazdi July 6, 2022

I used this user.js script run by TamperMonkey extension for now:

// ==UserScript==
// @name remove Line Separator character for Jira
// @namespace http://scripts.sadeq.uk/get-ride-of-line-separator.user.js
// @version 0.2
// @description this will remove inusefull Line Separator character from notes in Jira
// @author Sadeq
// @match https://*.atlassian.net/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=sadeq.uk
// @grant none
// ==/UserScript==

(function () {
'use strict';
var FixLSTimer;
const replaceOnDocument = (pattern, string, {target = document.body} = {}) => {
clearTimeout(FixLSTimer);
[
target,
...target.querySelectorAll("*:not(script):not(noscript):not(style)"),
].forEach(({childNodes: [...nodes]}) => nodes
.filter(({nodeType}) => nodeType === document.TEXT_NODE)
.forEach((textNode) => {
if (!textNode.isContentEditable) {
textNode.textContent = textNode.textContent.replace(pattern, string)
}
}
));
clearTimeout(FixLSTimer);
};

document.addEventListener('load', function(e) {
FixLSTimer = setTimeout( () => replaceOnDocument('\u2028', ''), 100);
}, true);

})();
0 votes
John Funk
Community Champion
June 24, 2022

Hi Sedeq - Welcome to the Atlassian Community!

Maybe try this: 

Use {{issue.summary.replaceAll("\n", "")}} to remove all newline characters ("\n") instead of {{issue.summary}}.

Sedeq Yazdi July 4, 2022

It is not \n (New Line character) it is Line Separator characterU+2028 or 0x2028 ) In addition I'm just a user. 

is there any solution for that?

 

 

ps. More information about this character available here: https://unicodemap.org/details/0x2028/index.html

John Funk
Community Champion
July 5, 2022

If the \n doesn't work, I am sorry but it's out of my league to solve. 

Sedeq Yazdi July 5, 2022

If i was the administrator I can use your suggested way to get ride of that but small change ( `\n` -> `\0x2028` ) but I just have user access :-/

John Funk
Community Champion
July 5, 2022

I would think you should request the administrator to make the change instead of working around it. 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events