@@ -219,6 +219,7 @@ body {{
219219}}
220220.timestamp {{
221221 color: #848484;
222+ user-select: none;
222223 text-decoration: none;
223224}}
224225.timestamp:hover {{
@@ -270,14 +271,19 @@ body {{
270271 var html = ansi_up.ansi_to_html(logs);
271272
272273 // 2. Remove UTF-8 useless BOM
273- if (html.charCodeAt(0) === 0xFEFF) {{
274- html = html.substr(1);
275- }}
276-
277- // 3. Add a self-referencial anchor to all timestamps at the start of the lines
278- const dateRegex = /^(\d{{4}}-\d{{2}}-\d{{2}}T\d{{2}}:\d{{2}}:\d{{2}}\.\d+Z)/gm;
279- html = html.replace(dateRegex, (ts) =>
280- `<a id="${{ts}}" href="#${{ts}}" class="timestamp">${{ts}}</a>`
274+ html = html.replace(/^\uFEFF/gm, "");
275+
276+ // 3. Transform each log lines that doesn't start with a timestamp into a row where everything is in the second column
277+ const untsRegex = /^(?!\d{{4}}-\d{{2}}-\d{{2}}T\d{{2}}:\d{{2}}:\d{{2}}\.\d+Z)(.*)$/gm;
278+ html = html.replace(untsRegex, (match, log) =>
279+ `<tr><td></td><td>${{log}}</td></tr>`
280+ );
281+
282+ // 3.b Transform each log lines that start with a timestamp in a row with two columns and make the timestamp be a
283+ // self-referencial anchor.
284+ const tsRegex = /^(\d{{4}}-\d{{2}}-\d{{2}}T\d{{2}}:\d{{2}}:\d{{2}}\.\d+Z) (.*)$/gm;
285+ html = html.replace(tsRegex, (match, ts, log) =>
286+ `<tr><td><a id="${{ts}}" href="#${{ts}}" class="timestamp">${{ts}}</a></td><td>${{log}}</td></tr>`
281287 );
282288
283289 // 4. Add a anchor around every "##[error]" string
@@ -324,8 +330,8 @@ body {{
324330 return `${{boundary_start}}<a href="https://github.com/{owner}/{repo}/blob/{sha}/${{path}}${{pos}}" class="path-marker">${{inner}}</a>${{boundary_end}}`;
325331 }});
326332
327- // 6. Add the html to the DOM
328- document.body .innerHTML = html;
333+ // 6. Add the html to the table
334+ document.getElementById("logs") .innerHTML = html;
329335
330336 // 7. If no anchor is given, scroll to the last error
331337 if (location.hash === "" && errorCounter >= 0) {{
@@ -353,6 +359,14 @@ body {{
353359 </script>
354360</head>
355361<body>
362+ <table style="table-layout: fixed">
363+ <colgroup>
364+ <col style="width: 29ch">
365+ <col style="width: 100%">
366+ </colgroup>
367+ <tbody id="logs">
368+ </tbody>
369+ </table>
356370</body>
357371</html>"### ,
358372 ) ;
0 commit comments