-
Notifications
You must be signed in to change notification settings - Fork 863
Add voice command for inserting markdown table headers #2309
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 7 commits
56199dc
d1abda8
b479bec
7a3b88a
ab06610
3cf7d18
545ee4d
8525612
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,3 +36,21 @@ def markdown_wrap_selection_with_link(url: str): | |
| """Wraps the selection with a markdown link for the specified url""" | ||
| description = actions.edit.selected_text() | ||
| actions.user.markdown_insert_link(url, description) | ||
|
|
||
| def markdown_insert_table_header(num_columns: int): | ||
| """Creates a table header with the given number of columns""" | ||
| if num_columns <= 0: | ||
| return | ||
| # build a snippet | ||
| # add the places to put the column names | ||
| snippet_body_parts = ["|"] | ||
| for i in range(num_columns): | ||
| snippet_body_parts.append(f" ${i + 1} |") | ||
| # add the dashed lines | ||
| snippet_body_parts.append("\n|") | ||
| snippet_body_parts.append("---|" * num_columns) | ||
| # put it all together | ||
| snippet_body = "".join(snippet_body_parts) | ||
| # directly insert the snippet body. | ||
| # Because the number of placeholders varies, we could not do this in a .snippet file. | ||
| actions.user.insert_snippet(snippet_body) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
In the default snippet backend used outside VS Code, Useful? React with 👍 / 👎. |
||
Uh oh!
There was an error while loading. Please reload this page.