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

Code blocks does not preserve TAB when loading Markdown #170

Open
jodator opened this issue May 7, 2020 · 4 comments
Open

Code blocks does not preserve TAB when loading Markdown #170

jodator opened this issue May 7, 2020 · 4 comments
Labels
bug Something isn't working upstream Dependent/related to external issues

Comments

@jodator
Copy link

jodator commented May 7, 2020

I was pasting code from my IDE to a suggestion:

	 *
	 *		const modelRoot = editor.model.document.getRoot();
	 *		const firstCell = modelRoot.getNodeByPath( [ 0, 0, 0 ] );
	 *		const lastCell = modelRoot.getNodeByPath( [ 0, 0, 1 ] );
	 *
	 *		const tableSelection = editor.plugins.get( 'TableSelection' );
	 *		tableSelection.setCellSelection( firstCell, lastCell );
	 *
	 * @param {module:engine/model/element~Element} anchorCell
	 * @param {module:engine/model/element~Element} targetCell

And the tabs characters were changed to spaces. This may break code style if such a suggestion is applied.

ps.: I had to switch to markdown to create this post ;)

@jodator jodator added the bug Something isn't working label May 7, 2020
@fredck fredck changed the title Code editing (suggestion) does not preserve TAB Code blocks does not preserve TAB when loading Markdown May 7, 2020
@fredck
Copy link
Contributor

fredck commented May 7, 2020

Confirmed. This is generic to code blocks, not only suggestions.

Can you just confirm the following?

  1. When pasting in the rte editor, the tabs are there, as expected.
  2. Switching to the Markdown editor, the above tabs are still there, as expected.
  3. Switching back to the rte editor, tabs are transformed to spaces. (issue)

Thanks!

@jodator
Copy link
Author

jodator commented May 7, 2020

@fredck I thought it removed the tabs on the first paste (when editing a suggestion in PR) but I can't reproduce it. However, I can confirm the case you described.

@fredck fredck added the upstream Dependent/related to external issues label May 8, 2020
@fredck
Copy link
Contributor

fredck commented May 8, 2020

Upstream issue: markedjs/marked#1668

@asherber
Copy link

asherber commented Jun 1, 2021

I agree that if you paste tabs into a fenced code block, they should stay as tabs. However I wish that this extension had a different but related feature: I'd like a setting such that when I type tabs in a fenced code block, they get converted to spaces, just like in all my text editors and IDEs. Is this possible?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working upstream Dependent/related to external issues
Projects
None yet
Development

No branches or pull requests

3 participants