Skip to content

Commit 3f38063

Browse files
authored
feat(chat-ui): syntax-highlighted code blocks and native tables in chat markdown (#100207)
* feat(chat-ui): syntax-highlighted code blocks and native GFM tables in shared chat markdown (#100195) * chore(chat-ui): sync native i18n inventory * fix(chat-ui): harden native markdown rendering * refactor(chat-ui): split HTML block patterns * refactor(chat-ui): parse markdown blocks with swift-markdown * style(chat-ui): satisfy SwiftFormat lint * fix(ios): bundle markdown dependency licenses * style(ios): normalize markdown license file * fix(ios): keep native markdown cards legible
1 parent d7e2096 commit 3f38063

14 files changed

Lines changed: 1939 additions & 192 deletions

apps/.i18n/native-source.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20115,15 +20115,15 @@
2011520115
},
2011620116
{
2011720117
"kind": "ui-call",
20118-
"line": 709,
20118+
"line": 710,
2011920119
"path": "apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatMessageViews.swift",
2012020120
"source": "Running tools…",
2012120121
"surface": "apple",
2012220122
"id": "native.apple.6b18ea1d85b5d3a2"
2012320123
},
2012420124
{
2012520125
"kind": "ui-call",
20126-
"line": 717,
20126+
"line": 718,
2012720127
"path": "apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatMessageViews.swift",
2012820128
"source": "\\(display.emoji) \\(display.label)",
2012920129
"surface": "apple",
Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
Copyright (c) 2014, John MacFarlane
2+
3+
All rights reserved.
4+
5+
Redistribution and use in source and binary forms, with or without
6+
modification, are permitted provided that the following conditions are met:
7+
8+
* Redistributions of source code must retain the above copyright
9+
notice, this list of conditions and the following disclaimer.
10+
11+
* Redistributions in binary form must reproduce the above
12+
copyright notice, this list of conditions and the following
13+
disclaimer in the documentation and/or other materials provided
14+
with the distribution.
15+
16+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27+
28+
-----
29+
30+
houdini.h, houdini_href_e.c, houdini_html_e.c, houdini_html_u.c
31+
32+
derive from https://github.com/vmg/houdini (with some modifications)
33+
34+
Copyright (C) 2012 Vicent Martí
35+
36+
Permission is hereby granted, free of charge, to any person obtaining a copy of
37+
this software and associated documentation files (the "Software"), to deal in
38+
the Software without restriction, including without limitation the rights to
39+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
40+
of the Software, and to permit persons to whom the Software is furnished to do
41+
so, subject to the following conditions:
42+
43+
The above copyright notice and this permission notice shall be included in all
44+
copies or substantial portions of the Software.
45+
46+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
47+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
48+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
49+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
50+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
51+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
52+
SOFTWARE.
53+
54+
-----
55+
56+
buffer.h, buffer.c, chunk.h
57+
58+
are derived from code (C) 2012 Github, Inc.
59+
60+
Permission is hereby granted, free of charge, to any person obtaining a copy of
61+
this software and associated documentation files (the "Software"), to deal in
62+
the Software without restriction, including without limitation the rights to
63+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
64+
of the Software, and to permit persons to whom the Software is furnished to do
65+
so, subject to the following conditions:
66+
67+
The above copyright notice and this permission notice shall be included in all
68+
copies or substantial portions of the Software.
69+
70+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
71+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
72+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
73+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
74+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
75+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
76+
SOFTWARE.
77+
78+
-----
79+
80+
utf8.c and utf8.c
81+
82+
are derived from utf8proc
83+
(<http://www.public-software-group.org/utf8proc>),
84+
(C) 2009 Public Software Group e. V., Berlin, Germany.
85+
86+
Permission is hereby granted, free of charge, to any person obtaining a
87+
copy of this software and associated documentation files (the "Software"),
88+
to deal in the Software without restriction, including without limitation
89+
the rights to use, copy, modify, merge, publish, distribute, sublicense,
90+
and/or sell copies of the Software, and to permit persons to whom the
91+
Software is furnished to do so, subject to the following conditions:
92+
93+
The above copyright notice and this permission notice shall be included in
94+
all copies or substantial portions of the Software.
95+
96+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
97+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
98+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
99+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
100+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
101+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
102+
DEALINGS IN THE SOFTWARE.
103+
104+
-----
105+
106+
The normalization code in normalize.py was derived from the
107+
markdowntest project, Copyright 2013 Karl Dubost:
108+
109+
The MIT License (MIT)
110+
111+
Copyright (c) 2013 Karl Dubost
112+
113+
Permission is hereby granted, free of charge, to any person obtaining
114+
a copy of this software and associated documentation files (the
115+
"Software"), to deal in the Software without restriction, including
116+
without limitation the rights to use, copy, modify, merge, publish,
117+
distribute, sublicense, and/or sell copies of the Software, and to
118+
permit persons to whom the Software is furnished to do so, subject to
119+
the following conditions:
120+
121+
The above copyright notice and this permission notice shall be
122+
included in all copies or substantial portions of the Software.
123+
124+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
125+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
126+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
127+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
128+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
129+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
130+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
131+
132+
-----
133+
134+
The CommonMark spec (test/spec.txt) is
135+
136+
Copyright (C) 2014-15 John MacFarlane
137+
138+
Released under the Creative Commons CC-BY-SA 4.0 license:
139+
<http://creativecommons.org/licenses/by-sa/4.0/>.
140+
141+
-----
142+
143+
The test software in test/ is
144+
145+
Copyright (c) 2014, John MacFarlane
146+
147+
All rights reserved.
148+
149+
Redistribution and use in source and binary forms, with or without
150+
modification, are permitted provided that the following conditions are met:
151+
152+
* Redistributions of source code must retain the above copyright
153+
notice, this list of conditions and the following disclaimer.
154+
155+
* Redistributions in binary form must reproduce the above
156+
copyright notice, this list of conditions and the following
157+
disclaimer in the documentation and/or other materials provided
158+
with the distribution.
159+
160+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
161+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
162+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
163+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
164+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
165+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
166+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
167+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
168+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
169+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
170+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

0 commit comments

Comments
 (0)