marksman
marksman copied to clipboard
code-action: TOC improvements
Closes #19
- Double indent links in TOC - otherwise they're not rendered as nested lists at all
- Enable YAML frontmatter parsing, and propagate it into the document index
- Add logic to decide an insertion point for TOC - under yaml front matter, at document beginning, under the single h1 title
- Refactor and extract code action logic away from Server
- Add helpers and tests to actually assert on the document contents after inserting TOC
TODO
- [ ] Tests that iteratively invoking code action does not add any more newlines (this is premonition - I'm pretty sure it's broken now :-/)
@keynmol I checked out locally to try things out. I think something got lost during rebase, as all this insertion logic from CodeActions.fs is not wired into Server.fs and is used only inside tests.
@artempyanykh This should be ready for review/another manual test
@keynmol could you rebase on the latest main please?
Done
Awesome! I did a bit of testing and it worked great. There was just one case where TOC ate a new line
LMK if you'd like to merge as is or fix the issue.
I'd rather merge as is (as long as it doesn't lines repeatedly), and then add this case to the tests with some other testing infra improvements