Skip to content
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

List Continuation for Markdown #1305

Open
benjamin-kirkbride opened this issue Jun 28, 2023 · 13 comments · May be fixed by #1328
Open

List Continuation for Markdown #1305

benjamin-kirkbride opened this issue Jun 28, 2023 · 13 comments · May be fixed by #1328

Comments

@benjamin-kirkbride
Copy link
Contributor

I would like to see automatic list continuation when editing markdown, as well as some other features like that.

Is such a thing able to be done with a plugin? Any tips?

Thanks :)

@benjamin-kirkbride
Copy link
Contributor Author

Example of list continuation:
type - first item followed by ENTER should result in:

- first item
- |

where | is the cursor

@rdbende
Copy link
Collaborator

rdbende commented Jun 28, 2023

It could be implemented in a plugin similarly to how the autoindent works.

Some IDEs also auto-close quotes and parentheses. Porcupine doesn't do this, though it would also be a useful feature. It might would be hard to get right.

@benjamin-kirkbride
Copy link
Contributor Author

@Moosems
Copy link
Contributor

Moosems commented Jun 28, 2023

@rdbende it was easily implemented in DIP...

@benjamin-kirkbride
Copy link
Contributor Author

@Moosems what do you mean?

@Moosems
Copy link
Contributor

Moosems commented Jun 28, 2023

Just make a dict of items to insert certain variations on and then context for each variation.

For example:

{
    "python":
    {
        "indent regex":
            [
                "action"
            ]
        ...
    }
}

@Moosems
Copy link
Contributor

Moosems commented Jun 28, 2023

Or even just a bind and associated action.

@benjamin-kirkbride
Copy link
Contributor Author

Is there some prior art here? Sorry I'm starting from ground zero here

@rdbende
Copy link
Collaborator

rdbende commented Jun 29, 2023

Just make a dict of items to insert certain variations on and then context for each variation.

For example:

{
"python":

{

   "indent regex":
       [
           "action"
       ]
   ...

}
}

Umm, wat??

@rdbende
Copy link
Collaborator

rdbende commented Jun 29, 2023

@benjamin-kirkbride So I'm guessing @Moosems is trying to say, that you could put some configuration about these auto-continuations into the filetype.toml file.
It could be a regular expression that you define similarly to how the autoindent regexes are. Then you can use this regex to find out when it should continue the markdown list, or even to auto-close a quote in some other language. This part could be quite similar to the autoindent plugin.

@benjamin-kirkbride
Copy link
Contributor Author

Ah, I see.

Any thoughts on TAB moving the list up, such that when in this position:

- item 1
- |

pressing TAB would result in:

- item 1
    - |

?

@Akuli
Copy link
Owner

Akuli commented Jun 29, 2023

I like both of your ideas :) Ideally they would be in the same plugin. For the initial version, the plugin could just check whether the filetype is set to Markdown. We can later make it configurable in filetypes.toml, so that other similar formats (e.g. RST) can benefit from it too.

@Moosems what do you mean?

DIP is Moosems's closed-source editor project. Maybe the "For example" thing was part of a configuration file for DIP.

You don't really need to know anything about DIP to work on Porcupine, but you will occasionally see Moosems talking about it on Porcupine's issue tracker.

@Moosems
Copy link
Contributor

Moosems commented Jun 29, 2023

Yes you will 🤣. In DIP (my personal project) I use a list of chars to finish with and their endings. This could be updated to check a line for its contents by regex and cases but that was the idea I presented :).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants