GitbookIO / slate-edit-code

A Slate plugin for code block editing
https://gitbookio.github.io/slate-edit-code/
Apache License 2.0
43 stars 34 forks source link

How exactly does one use the getIndent option? #44

Open Nantris opened 6 years ago

Nantris commented 6 years ago

Can anyone let me know what the expected input for the function is? I tried passing just a string value of (two spaces) but that didn't have any effect.

jfrolich commented 6 years ago

Same here

Soreine commented 6 years ago

Maybe it's convoluted to have it as a function... but you need to pass a function of the current value

Here is what you could do:

getIndent: value => '  '

Do you have tips for improvement on the documentation about that option ?

Nantris commented 6 years ago

@Soreine thanks very much for your reply. Unfortunately I tried that too and it has no effect for me. No errors, but still 4 spaces for indentation.

This is my options object:

{
  containerType: 'codeBlock',
  lineType: 'codeLine',
  exitBlockType: 'paragraph',
  selectAll: true,
  getIndent: value => '  ',
};

Any thoughts as to what the problem could be here?

Soreine commented 6 years ago

Alright, then it's probably a bug. I'll see where it comes from. The plugin also has an indent auto-detection feature, maybe it's conflicting here with the option, though it should not.

Nantris commented 6 years ago

@Soreine thanks very much for taking the time to look into this. I tried to track it down back when I filed this issue, but I wasn't able to find the source of this issue. Everything seemed right except the output.

xndyz commented 5 years ago

Is this still a bug, or are we able to change it to use two spaces for indenting now?

Nantris commented 5 years ago

Still a bug last I checked. If you find a way to fix it, I'd be interested.