Console: Add support for copying tables as Markdown or CSV [devtools/devtools-frontend : main]

0 views
Skip to first unread message

Jack Franklin (Gerrit)

unread,
Jul 3, 2026, 6:59:34 AM (yesterday) Jul 3
to Nicholas Roscino, devtools-fro...@luci-project-accounts.iam.gserviceaccount.com, devtools-rev...@chromium.org
Attention needed from Nicholas Roscino

Jack Franklin voted and added 2 comments

Votes added by Jack Franklin

Auto-Submit+1
Commit-Queue+1

2 comments

Patchset-level comments
File-level comment, Patchset 10 (Latest):
Jack Franklin . resolved

ptal

File front_end/ui/legacy/components/data_grid/DataGridExporter.ts
Line 56, Patchset 5:function escapeMarkdown(val: string): string {
Nicholas Roscino . resolved

I played a bit with this this function. I think that we should also escape HTML tags and other special characters like the `*` as it will otherwise be rendered incorrectly in Markdown.

Jack Franklin

Right, I guess your logic is if the console table contains the string `"**foo**"` then we don't want that to be bold, but the literal string? Maybe we should define a list of special chars and backslash before a bunch of them.

Nicholas Roscino

Yeah exactly. in my test I had bold, italic and also a cell containing an html tag and they were then rendered in the markdown result

Jack Franklin

Nice, thanks for thinking about that! I can't believe it didn't cross my mind 😄 I will have a play with this and ping you again when I have a new patch.

Nicholas Roscino

Sure! No problem!

Jack Franklin

Done

Open in Gerrit

Related details

Attention is currently required from:
  • Nicholas Roscino
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: devtools/devtools-frontend
Gerrit-Branch: main
Gerrit-Change-Id: I0aeb8c5ea01eaf46d0c6fe764eeee5b31fe55476
Gerrit-Change-Number: 8036461
Gerrit-PatchSet: 10
Gerrit-Owner: Jack Franklin <jacktf...@chromium.org>
Gerrit-Reviewer: Jack Franklin <jacktf...@chromium.org>
Gerrit-Reviewer: Nicholas Roscino <nros...@chromium.org>
Gerrit-Attention: Nicholas Roscino <nros...@chromium.org>
Gerrit-Comment-Date: Fri, 03 Jul 2026 10:59:30 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: Nicholas Roscino <nros...@chromium.org>
Comment-In-Reply-To: Jack Franklin <jacktf...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Nicholas Roscino (Gerrit)

unread,
Jul 3, 2026, 7:01:42 AM (yesterday) Jul 3
to Jack Franklin, devtools-fro...@luci-project-accounts.iam.gserviceaccount.com, devtools-rev...@chromium.org
Attention needed from Jack Franklin

Nicholas Roscino voted and added 1 comment

Votes added by Nicholas Roscino

Code-Review+1
Commit-Queue+2

1 comment

Patchset-level comments
Nicholas Roscino . resolved

LGTM! Thank you!

Open in Gerrit

Related details

Attention is currently required from:
  • Jack Franklin
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: devtools/devtools-frontend
Gerrit-Branch: main
Gerrit-Change-Id: I0aeb8c5ea01eaf46d0c6fe764eeee5b31fe55476
Gerrit-Change-Number: 8036461
Gerrit-PatchSet: 10
Gerrit-Owner: Jack Franklin <jacktf...@chromium.org>
Gerrit-Reviewer: Jack Franklin <jacktf...@chromium.org>
Gerrit-Reviewer: Nicholas Roscino <nros...@chromium.org>
Gerrit-Attention: Jack Franklin <jacktf...@chromium.org>
Gerrit-Comment-Date: Fri, 03 Jul 2026 11:01:38 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
open
diffy

Jack Franklin (Gerrit)

unread,
Jul 3, 2026, 9:24:01 AM (yesterday) Jul 3
to Nicholas Roscino, devtools-fro...@luci-project-accounts.iam.gserviceaccount.com, devtools-rev...@chromium.org
Attention needed from Nicholas Roscino

Jack Franklin voted Commit-Queue+2

Commit-Queue+2
Open in Gerrit

Related details

Attention is currently required from:
  • Nicholas Roscino
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: devtools/devtools-frontend
Gerrit-Branch: main
Gerrit-Change-Id: I0aeb8c5ea01eaf46d0c6fe764eeee5b31fe55476
Gerrit-Change-Number: 8036461
Gerrit-PatchSet: 11
Gerrit-Attention: Nicholas Roscino <nros...@chromium.org>
Gerrit-Comment-Date: Fri, 03 Jul 2026 13:23:57 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
open
diffy

devtools-frontend-scoped@luci-project-accounts.iam.gserviceaccount.com (Gerrit)

unread,
Jul 3, 2026, 9:26:01 AM (yesterday) Jul 3
to Jack Franklin, Nicholas Roscino, devtools-rev...@chromium.org

devtools-fro...@luci-project-accounts.iam.gserviceaccount.com submitted the change with unreviewed changes

Unreviewed changes

10 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:

```
The name of the file: front_end/panels/console/ConsoleViewMessage.test.ts
Insertions: 1, Deletions: 1.

@@ -609,7 +609,7 @@
assert.exists(markdownItem);

contextMenu.invokeHandler(markdownItem.id());
- const expectedMarkdown = '| (index) | a |\n' +
+ const expectedMarkdown = '| \\(index\\) | a |\n' +
'| --- | --- |\n' +
'| 0 | 1 |';
sinon.assert.calledOnceWithExactly(copyTextStub, expectedMarkdown);
```

Change information

Commit message:
Console: Add support for copying tables as Markdown or CSV

Console tables printed via console.table() contain structured data
that is difficult to extract for external use.

To allow users to export this data, introduce context menu options to
copy table views as Markdown or CSV. This is implemented by:
- Creating a DataGridExporter utility containing standalone functions
exportToMarkdown and exportToCSV. This serializes the visual
DataGrid contents, extracting text from DOM nodes within cell values,
and applying standard escaping rules for Markdown and CSV syntax.
- Extending DataGridImpl to support custom table-wide context menus via
a new callback hook (setTableContextMenuCallback).
- Integrating this hook in ConsoleTableMessageView to present the copy
options and write the serialized table contents to the clipboard.
Fixed: 40924951
Change-Id: I0aeb8c5ea01eaf46d0c6fe764eeee5b31fe55476
Auto-Submit: Jack Franklin <jacktf...@chromium.org>
Reviewed-by: Nicholas Roscino <nros...@chromium.org>
Commit-Queue: Jack Franklin <jacktf...@chromium.org>
Files:
  • M config/gni/devtools_grd_files.gni
  • M front_end/panels/console/ConsoleViewMessage.test.ts
  • M front_end/panels/console/ConsoleViewMessage.ts
  • M front_end/ui/legacy/components/data_grid/BUILD.gn
  • M front_end/ui/legacy/components/data_grid/DataGrid.test.ts
  • M front_end/ui/legacy/components/data_grid/DataGrid.ts
  • A front_end/ui/legacy/components/data_grid/DataGridExporter.test.ts
  • A front_end/ui/legacy/components/data_grid/DataGridExporter.ts
  • M front_end/ui/legacy/components/data_grid/data_grid.ts
  • M front_end/ui/visual_logging/KnownContextValues.ts
Change size: L
Delta: 10 files changed, 432 insertions(+), 1 deletion(-)
Branch: refs/heads/main
Submit Requirements:
  • requirement satisfiedCode-Review: +1 by Nicholas Roscino
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: devtools/devtools-frontend
Gerrit-Branch: main
Gerrit-Change-Id: I0aeb8c5ea01eaf46d0c6fe764eeee5b31fe55476
Gerrit-Change-Number: 8036461
Gerrit-PatchSet: 12
Gerrit-Owner: Jack Franklin <jacktf...@chromium.org>
Gerrit-Reviewer: Jack Franklin <jacktf...@chromium.org>
Gerrit-Reviewer: Nicholas Roscino <nros...@chromium.org>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages