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

ability to embed external files #2854

Closed
nektro opened this issue May 16, 2024 · 5 comments
Closed

ability to embed external files #2854

nektro opened this issue May 16, 2024 · 5 comments

Comments

@nektro
Copy link

nektro commented May 16, 2024

it would be nice if perhaps for things like web idl or railroad diagrams the source could be stored in standalone files that are embedded into the document at build-time.

@nektro nektro changed the title ability to embed external files inside a <pre> ability to embed external files May 21, 2024
@nektro
Copy link
Author

nektro commented May 24, 2024

retrieving the IDL from a spec appears possible with the following:

console.log([...document.querySelectorAll("pre.idl")].map(v=>v.innerText).join(""))

but it would be nicer if .idl source files were external to the .bs files so that parsing html wasn't strictly necessary
and you could depend on the spec git repos directly

@nektro
Copy link
Author

nektro commented May 24, 2024

appears https://github.com/w3c/webref/tree/main/ed/idl/ also has this content :O

@tabatkins
Copy link
Collaborator

It sounds like you have two separate requests:

  1. You want all the IDL from specs (including ones you're not in control of) - any solution I give in Bikeshed won't help with this, as people write their source markup in many ways, and when they're actually published to the W3C the source files aren't included anyway. But yes, WebRef is a W3C project to parse all the IDL (and a lot more) from all web-relevant specs, so you can use that instead. (Bikeshed uses it for its own autolinks!)

  2. You want to write some things, like IDL, outside of your own source file (for ease of editting, or syntax highlighting, or what-have-you), and just include them into your final file. Bikeshed has this feature already, and in particular lets you do source code inclusion, like WebIDL.

@tabatkins
Copy link
Collaborator

Tho to be fair, I don't have the ability to include an external source file and parse it like it were a particular datablock - like if you wanted to write a railroad diagram in an external file, currently you'd have to put the <pre class=railroad> into your external file to trigger the correct processing. But that's definitely something I could do.

@nektro
Copy link
Author

nektro commented May 24, 2024

https://speced.github.io/bikeshed/#including looks like exactly what I was looking for so I'm happy to close as-is. thank you!

there is a corollary proposal I was eventually interested in making to w3c but didn't know if this feature existed and didn't see any other issues about it so I came here first before potentially taking up any contributor bandwidth over there.

@nektro nektro closed this as completed May 24, 2024
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

No branches or pull requests

2 participants