From 216dee9e948cc4d10956aba030059e55246cd5c0 Mon Sep 17 00:00:00 2001 From: Jakub Jankiewicz Date: Sat, 20 Apr 2024 19:59:59 +0200 Subject: [PATCH] alow using attributes in color xml tags #924 --- CHANGELOG.md | 3 ++- js/xml_formatting.js | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d9e5c66e..b2376bdc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## 2.40.0 ### Features -* Don't force any attributes when using xml (`span`, `img`, and `a` tags) [#913](https://github.com/jcubic/jquery.terminal/issues/913) +* don't force any attributes when using xml (`span`, `img`, and `a` tags) [#913](https://github.com/jcubic/jquery.terminal/issues/913) +* alow using attributes in color xml tags [#924](https://github.com/jcubic/jquery.terminal/issues/924) ### Bugfix * fix init and resize of long prompt [#919](https://github.com/jcubic/jquery.terminal/issues/919) * fix occasional selecting Accessibility label (about clipboard textarea) in CMD diff --git a/js/xml_formatting.js b/js/xml_formatting.js index 1557f494..208d1f83 100644 --- a/js/xml_formatting.js +++ b/js/xml_formatting.js @@ -145,7 +145,9 @@ if (tags[name]) { return tags[name](attrs); } else { - return '[[;' + name + ';]'; + var cls = attrs.class || ''; + var formatting = ['', name, '', cls, '', JSON.stringify(attrs)]; + return '[[' + formatting.join(';') + ']'; } } return string.replace(/</g, '<').replace(/>/g, '>');