-
-
Notifications
You must be signed in to change notification settings - Fork 389
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
Apparent requirement for nested includes and/or simpler markdown inclusion #3426
Comments
I'm hesitant to support nested includes, as it makes it difficult for the tools (e.g. pr-preview) that need to parse the
I'm assuming this would require adding some Jekyll specific front-matter to all the source files also? Currently, ReSpec doesn't parse/remove the front-matter.
Perhaps this file (source of https://respec.org/docs/) could be of some help? It makes extensive use of flattened I can write a minimal example to show headings working correctly if that would be helpful.
Flattening the includes definitely does mean repeating includes in each page, but it makes sense as they're separate ReSpec documents. |
Thanks @sidvishnoi .
There are tools other than respec that process respec enhanced HTML source docs? I hadn't considered that as something that would happen. But surely use of nested includes is optional and if those other tools are not be used on a document then it should be reasonable to allow nested includes. Perhaps with a warning in the docs?
Actually was thinking of the reverse. parsing the individual source files to generate either YAML frontmatter or perhaps a Jekyll data file. The latter looks possible even though Jekyll is not as flexible with data as 11ty. Some of the data depends on structure so may be fiddly to generate (my next task is to spike this). an alternative would be to use filename convention to specify the structure. As an alternative, allowing Yaml frontmatter in a respec source doc would be a most welcome addition though. :) Thank you so much for the examples! In this case there will be a single top level "Design Guide" doc with all the includes.
That's not a problem as there is a single top level document (content usable). It's unfortunate that that already includes the document I want to structure so I have to push all the includes up, so increasing the complexity of the top document and how it is parsed to get at the Design Guide section contents |
pr-preview is one of them. In future, ReSpec's Node.js API might also make use of parsing
Partial support sounds reasonable to me. cc: @marcoscaceres
Sorry if I misunderstood, does this mean nested includes won't be helpful? |
No, quite the opposite :) nested includes let's us place all the design guide includes in the design guide file. Otherwise every include has to be in the top level doc which will make it messy and harder to extract metadata for the design guide frontmatter. |
Thanks for that. I can't figure how to view the source code for it though. I tried saving the file but it appears to be already processed. thanks |
@SteveALee You can right-click > "view page source" on any page to get unprocessed source code: |
@sidvishnoi - Gosh, after all these years I never noticed that - always used "inspect element" or "Save As". Even works in FFx. \0/ Thanks for the education!!! :-P |
@sidvishnoi Closing now as have solution to nesting thanks to you feedback. It seems the flexibility of replacing tag or not helps. Markdown include is now working well for me too. I put the frontmatter in a pre element which is removed by respec. Pre should stop editors messing up the format. No need for respec support of frontmatter FYI - here's were we have got to so far. Uses a simple bash script to convert included files to Jekyll pages for the WAI website. All works very well |
Happy to know it worked for you @SteveALee! Curious to know why using:
instead of |
I have no idea as I inherited it as is :) There also seem to be an onInclude handler that doesn't exist which I need to check. I will pass the question on though. thanks |
Steve asked me to answer the question 2 comments ago. In the past respecConfig.postProcess didn't work (or stopped working, or something). I got used to having to work around it, and assumed the documentation simply hadn't been updated (very super duper common problem). Further, the documentation for respecIsReady specifies it is the way to meet the use case. I assumed it was the feature replacing the postProcess directive. When respecIsReady stopped working, I had to dive into code to find it's been replaced by ready, so the documentation is clearly out of date on that one. From the documentation, I have no idea what works, what is supposed to work but doesn't, and what is supposed to not work. I just do whatever I can find that gets me the result I'm looking for, and move on, I don't have time to figure out what is considered the "right" thing. Clearer, more comprehensive, and up-to-date documentation would certainly help. |
Thanks @michael-n-cooper. |
Background
I'm working on the W3C note Content Usable in order to also render the Design Guide section as a set of web pages in the W3C WAI website.
The WAI website is built using the Jekyll SSG and the design guide section is currently a single HTML + respec file. The basic goal is to refactor the Design Guide into a number of files that can be consumed by the SSG with minimal processing. The structure will also be processed by respec and saved as usual for the W3C note.
Is your feature request related to a problem? Please describe.
Matching includes to section structure
So the structure of the Design guide is as follows:
With each heading and section(s) being contents of one file.
file DG:
file O_1
File P_1:
etc
This would be naturally suggest nested includes but they are not supported.
Flattening the structure requires markup or content that should be in the included file to be in the including file. Plus I found it impossible to get the section tags correctly nested. This all complicates file processing and a 1 to 1, section to file mapping appears to be the natural solution.
Markdown
Ideally the files will all contain markdown but as the content is currently HTML that will be OK.
Describe the solution you'd like
And also when using markdown:
Describe alternatives you've considered
Any suggestions are most welcome on how to implement this now, or with some tweaks to respec for nested include of html and markdown.
PS @michael-n-cooper is also currently looking at the refactoring of the source files as part of the note release process.
The text was updated successfully, but these errors were encountered: