How to make folding UI in gutter lines from code?


#1

How to make folding UI in gutter lines from code?
Can atom support headline folding for markdown in editor?

background

I’m developing https://atom.io/packages/language-review package.
review is format of text likes markdown.

e.g.

= Headline indentLevel 1

foo

== Headline indentLevel 2 (increaseIndent)

bar

=== Headline indentLevel 3 (increaseIndent)

buzz

== Headline indentLevel 2 (decreaseIndent)

bizz

I want to add code folding for headline.
but it can’t implement by foldEndPattern and increaseIndentPattern the same as markdown.
end of section is equal to start of next headline (or eof). and increase or decrease indent is depends on prev headline.
but it can’t present by regexp. (isn’t it?)

BTW, I can get AST of Re:VIEW. It present to headline node location.

e.g.

let startRow = headline.location.start.line - 1;
let endRow = headline.location.end.line - 1;
let fold = editor.createFold(startRow, endRow);

but it is not present folding toggle button to gutter lines.
expected.

Does atom has API of add toggle folding UI?


In markdown.