Skip to content

chore: Reduce conversion processes#337

Open
thompson-tomo wants to merge 15 commits intothlorenz:masterfrom
thompson-tomo:chore/optimiseParsing
Open

chore: Reduce conversion processes#337
thompson-tomo wants to merge 15 commits intothlorenz:masterfrom
thompson-tomo:chore/optimiseParsing

Conversation

@thompson-tomo
Copy link
Copy Markdown
Contributor

@thompson-tomo thompson-tomo commented Apr 7, 2026

Progresses #153
Progresses #258
Progresses #279

This works to further improve the code path and reduce un-necessary operations during the file handling process.

Previously we had:

  • File content was being read
  • content was being split based on EOL
  • content was being parsed line by line looking for toc
  • file content was transformed to ast to get markdown headers
  • file content was transformed to ast to get html headers
  • toc string built
  • toc split into lines
  • toc lines spliced into content lines
  • content lines merged back into content

Now we just have

  • File content was being read
  • file content was transformed to ast
  • get toc from ast
  • get markdown headers from ast
  • get html headers from ast
  • toc string built
  • content built by merging content to prior old toc, new toc & after old toc.

Hence with this new approach the transformation is reduced & ensures that we only touch the toc and not the entire doc.

This will hopefully improve performance of larger files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants