yzhang-gh / vscode-markdown

Markdown All in One
https://marketplace.visualstudio.com/items?itemName=yzhang.markdown-all-in-one
MIT License
2.93k stars 325 forks source link

Format selection #1070

Open segevfiner opened 2 years ago

segevfiner commented 2 years ago

Proposal

You can currently format the entire Markdown document which formats the tables in it. Yet you sometimes encounter Markdown documents in projects that are not already fully formatted and you want to edit a format one of the tables in them without disturbing the others. It would be useful to have a command to only format the selection instead of the entire document for this.

Whether VS Code already has some builtin contribution point for such a command or it requires a custom one, I haven't checked.

Lemmingh commented 2 years ago

VS Code has a concept called "range formatting" which is invoked by the "Format Selection" (editor.action.formatSelection) command.

But I don't think "range formatting" is generally possible for Markdown, from the perspective of formal language theory.


Help wanted

Please evaluate the problem if you are experienced in formal language, automata, compiler, or related fields. Thank you.

peaceshi commented 11 months ago

https://github.com/yzhang-gh/vscode-markdown/pull/1361