-
-
Notifications
You must be signed in to change notification settings - Fork 6
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
[2.x] Blade-based table of contents generator #2045
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
caendesilva
force-pushed
the
blade-table-of-contents-system
branch
from
December 1, 2024 13:06
8f6f3d6
to
b67c4f3
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## new-asset-system #2045 +/- ##
====================================================
Coverage 100.00% 100.00%
- Complexity 1906 1914 +8
====================================================
Files 195 195
Lines 5080 5094 +14
====================================================
+ Hits 5080 5094 +14 ☔ View full report in Codecov by Sentry. |
caendesilva
force-pushed
the
blade-table-of-contents-system
branch
from
December 1, 2024 15:02
5d173b4
to
82fdf8c
Compare
caendesilva
added
the
run-visual-tests
Internal label to trigger Browserstack visual testing
label
Dec 1, 2024
Co-Authored-By: StyleCI Bot <bot@styleci.io>
caendesilva
force-pushed
the
blade-table-of-contents-system
branch
from
December 1, 2024 15:16
ba80f0c
to
9ef45dc
Compare
This was referenced Dec 1, 2024
Merged
caendesilva
force-pushed
the
blade-table-of-contents-system
branch
from
December 1, 2024 15:22
8d35846
to
ccd2942
Compare
github-actions
bot
removed
the
run-visual-tests
Internal label to trigger Browserstack visual testing
label
Dec 1, 2024
Remaining tasks: Undefined array key "slug" with this: ## test
### test Add this PR to release notes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Abstract
This allows the table of contents to be customized by publishing the Blade component, and is now styled using real TailwindCSS.
It's also up to 20 times faster, and up to 40 times faster not factoring in the Blade timings.
Changes
If you have used the
Hyde\Framework\Actions\GeneratesTableOfContents
class in custom code, you will likely need to update that code for the rewritten class.If you have called the
getTableOfContents
method of theDocumentationPage
class in custom code, you will need to update that usage as the that message has been removed.If you have published the
resources/views/components/docs/sidebar-item.blade.php
component, you will need to update it to call the new component instead of the old generator rendering.resources/views/components/docs/table-of-contents.blade.php
component containing the structure and styles for the table of contentsGeneratesTableOfContents
class to use a custom implementation instead of using CommonMarkexecute
method of theGeneratesTableOfContents
class now returns an array of data, instead of a string of HTML. This data should be fed into the new componenttable-of-contents.css
file as styles are now made using TailwindBenchmarks
Before Benchmarks
Small Document Benchmark
Hyde Documentation Benchmarks
Scaling Test
When appending the hydekernel document to itself three times, the benchmark shows:
New System
Small Document Benchmark
Hyde Documentation Benchmarks
Generation Without Blade
Lightweight Generation Benchmark
Scaling Performance
Hydekernel docs benchmark:
This shows a very close to linear scaling performance.
Comparison
Based on the benchmarks, let's compare the performance of the new system to the old one:
For the small document:
For the hydekernel.md document:
For the hydekernel.md document x3:
In summary:
The new system not only shows significant speed improvements but also scales better with larger documents. While the old system scaled linearly with document size, the new system shows sub-linear scaling, which is a substantial improvement in performance, especially for larger documents.
ed improvements but also scales better with larger documents. While the old system scaled linearly with document size, the new system shows sub-linear scaling, which is a substantial improvement in performance, especially for larger documents.
Comparison (Just Generation Without Blade)
Based on the benchmarks, let's compare the performance of the new system (just generation without Blade) to the old system:
For the small document:
For the hydekernel.md document:
For the hydekernel.md document x3:
For the hydekernel.md document x5:
In summary:
The new system shows dramatic speed improvements across all document sizes. It also demonstrates excellent scaling characteristics, maintaining its performance advantage even as document size increases. This represents a substantial improvement in performance, especially for larger documents, and should significantly enhance the overall efficiency of the markdown processing pipeline.