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

Feature Request: Expandable code regions #10

Open
Lastique opened this issue Aug 24, 2020 · 0 comments
Open

Feature Request: Expandable code regions #10

Lastique opened this issue Aug 24, 2020 · 0 comments

Comments

@Lastique
Copy link
Member

I would like to be able to specify expandable code regions in the examples imported using import. Having that in the inline code sample would be nice, too, but not my concern right now.

The primary use case is to be able to include #includes in the code samples, hidden by default, so that users are able to view them by clicking on some marker. So, for example, by default the code sample would look like this:

+ #include ...

  void foo()
  {
    // example code here
  }

And after clicking on the "+" it would expand to:

- #include <foo>
  #include <bar>

  void foo()
  {
    // example code here
  }

I realize this would probably require some JavaScript and I have no idea if the BoostBook backend allows this at all, but the feature would be very useful in Boost.Log docs. In Boost.Log, users are asking to see the includes, but the amount of includes sometimes come close in size to the code sample itself, so I'd rather not show them by default.

There may be other cases for this feature as well, such as showing evolution of some code across several code samples, where the pieces of code added previously are shown hidden by default, expandable on click, and the new code is displayed. I'm not sure if there are cases when I'd want an expandable region shown by default, but it would probably be a good idea to have that option. I.e. the markup should probably allow a way to specify if the region has to be hidden or expanded by default.

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

1 participant