HTML descriptions #235
Unanswered
saumier
asked this question in
Data Model
Replies: 1 comment 1 reply
-
|
Email 2025-SEP-12 from @fjjulien :
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Email 2025-SEP-12 from @saumier:
I propose the following approach for formatting text descriptions (schema:description) in the Artsdata core graph. This approach will restrict the allowed HTML tags and attributes (sanitize), and also convert text with problematic line breaks, tabs, and spaces into simple formatted HTML.
Allowed tags:
Allowed attributes:
href, rel, target (for
<a>tags)Convert single newlines (\n) into
<br />, and two or more consecutive newlines (\n\n or \r\n\r\n) into</p><p>. Wrap the entire text with<p>...</p>.Example:
"Title\nFirst line\n\nSecond section" →
<p>Title<br />First line</p><p>Second section</p>Strip leading and trailing whitespace (spaces, tabs), and replace all internal whitespace (spaces, tabs) with a single space.
Example:
" one two\t\t\t\t\tthree " → "one two three"
Note: this will make all description fields html. Event a single line of text will have
<p>.Beta Was this translation helpful? Give feedback.
All reactions