-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Markdown Lists - Task List, Tab behavior #5056
Labels
Comments
I did kind of hack the Tab indentation into ACE at runtime, by overwriting the const session = editor.getSession();
const matchMdList = /^\s*(-|\*) (\[( |x)\] )?$/;
editor.oldIndent = editor.indent;
editor.indent = function() {
var range = this.getSelectionRange();
if (range.start.row !== range.end.row || range.start.column !== range.end.column || range.start.column === 0) {
return this.oldIndent();
}
range.start.column = 0;
if (!matchMdList.test(session.getTextRange(range))) {
return this.oldIndent();
}
var rows = this.$getSelectedRows(); // not sure if I could also use range.start.row, but this is how the original indent does it
session.indentRows(rows.first, rows.last, "\t");
} |
This issue has not received any attention in 1 year. If you want to keep this issue open, please leave a comment below and auto-close will be canceled. |
Unsubscribe
Remove
Get Outlook for iOS<https://aka.ms/o0ukef>
…________________________________
From: github-actions[bot] ***@***.***>
Sent: Wednesday, March 20, 2024 12:04:42 PM
To: ajaxorg/ace ***@***.***>
Cc: Subscribed ***@***.***>
Subject: Re: [ajaxorg/ace] Markdown Lists - Task List, Tab behavior (Issue #5056)
This issue has not received any attention in 1 year. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.
—
Reply to this email directly, view it on GitHub<#5056 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AFQLBHJLYBMAWAEBWYAWA2LYZGXRVAVCNFSM6AAAAAAUXYHGHWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMBZHEZTKMBQGM>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the feature
It would be nice if task lists were supported (https://github.github.com/gfm/#task-list-items-extension-), i.e. when pressing Enter while in a task list, the next line should start with
* [ ]
.Another nice behavior would be if I press Tab at the beginning of an empty list item (i.e. with the caret right after
*
or3.
or* [ ]
), the whole line should be indented, including the list item itself. This should probably only happen if the previous line also starts with a list item definition.Use Case
Quicker creation of task lists and sub-lists.
Proposed Solution
https://github.com/ajaxorg/ace/blob/master/src/mode/markdown.js#L33
The match regular expression could look like this:
Not sure if there should always be an empty
[ ]
inserted, the code above would keep the checkbox state of the previous item.No idea how to implement the Tab behavior. I don't see anything in the ace
indent
function that would allow customizing this from within the markdown mode?Anyway, it should take the above regular expression into account, check if the current and the previous line start with this regexp, and if the current caret is positioned right after that. If yes, the whole line should be indented.
Other Information
No response
Acknowledgements
ACE version used
1.14.0
The text was updated successfully, but these errors were encountered: