Skip to content
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

Plugin improvements #132

Merged
merged 7 commits into from
Mar 29, 2024
Merged

Plugin improvements #132

merged 7 commits into from
Mar 29, 2024

Conversation

dobarx
Copy link
Contributor

@dobarx dobarx commented Mar 22, 2024

  • Improves plugin schema and allows to specify content location & invocation order from plugin level.
  • TOC can now be placed anywhere inside document and it will be invoked last and content placed on top.
  • FrontMatter now is rendered at the top of the markdown.
  • Text calculates relative title size.

@dobarx dobarx requested review from traut and Andrew-Morozko March 22, 2024 09:27
@traut
Copy link
Member

traut commented Mar 22, 2024

TOC can now be placed anywhere inside document and it will be invoked last and content placed on top.

can both of these be configured? For the cases where TOC should render for a specific section (not the whole doc) and be placed in a specific location, instead just on the top of the doc.

With depends_on, for example, we could define a scope for TOC. As for the location, maybe we need place_at_the_top_of_the_doc (or something) bool flag, that defaults to true, but can be see to false with TOC placed inline.

apologies if some of this is covered, I haven't looked through the code yet!

text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor dolore magna."
}
content text {
text = "Sub title 3"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these sub titles would be on the same level as Title 1. They would be sub- titles if they would be inside the section that defines nesting

Copy link
Contributor Author

@dobarx dobarx Mar 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From specs it says:

If format_as is title and absolute_title_size is not set, the relative title size is calculated from the local context object that contains a document body (issue TBD) -- the multiplier for # for a Markdown title prefix is the number of title text seen previously in the document

So shouldn't it be lower level?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or do we need to calculate it based on section nesting instead of previous titles?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My apologies. I think I described it the wrong way there!

If we think of the template as a tree, the deeper you go down the branch, the smaller titles get. The nested sections would represent depth -- so the title should be calculated looking for previous titles up the branch to a root level

@dobarx
Copy link
Contributor Author

dobarx commented Mar 22, 2024

TOC can now be placed anywhere inside document and it will be invoked last and content placed on top.

can both of these be configured? For the cases where TOC should render for a specific section (not the whole doc) and be placed in a specific location, instead just on the top of the doc.

With depends_on, for example, we could define a scope for TOC. As for the location, maybe we need place_at_the_top_of_the_doc (or something) bool flag, that defaults to true, but can be see to false with TOC placed inline.

apologies if some of this is covered, I haven't looked through the code yet!

Ahh, so then I should turn off content placement at top for it and keep original one? As for the scope it should be based on scope variable that can either be document or section

@dobarx
Copy link
Contributor Author

dobarx commented Mar 25, 2024

Fixes:

  • Split text into separate title, text, code, blockquote blocks. Refactor content.text options into separate content providers #133
  • Transformed content in data context from flat list to tree structure
  • All content elements contain unique IDs that can be used to find or replace content elements from plugin level.
  • InvocationOrder no-longer effects content position in the rendered markdown. TOC content can be rendered in the same position where it is defined even though it is instructed to executed last.

@dobarx dobarx requested a review from traut March 25, 2024 18:54
@dobarx
Copy link
Contributor Author

dobarx commented Mar 25, 2024

Fixes:

  • Decreased title low size values to zero.

@traut
Copy link
Member

traut commented Mar 29, 2024

@dobarx dobarx merged commit 24a086f into main Mar 29, 2024
7 checks passed
@dobarx dobarx deleted the plugin_improvements branch March 29, 2024 10:44
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.

3 participants