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

Import code from codebases #2496

Closed
drdozer opened this issue Nov 25, 2024 · 1 comment
Closed

Import code from codebases #2496

drdozer opened this issue Nov 25, 2024 · 1 comment
Labels
C-enhancement Category: Enhancement or feature request

Comments

@drdozer
Copy link

drdozer commented Nov 25, 2024

Problem

I am sorry if this is already supported and I missed it. I'd like to be able to write my book, and display code blocks or fragments from real source files. Without copy-pasting the code into the book. So by specifying the file it comes from, and some locator information (line number, regex, function name, whatever), ideally some locator that's robust to the source being edited. I need the source to be guaranteed runnable, and keeping code blocks in sync with the code is a PITA. Also, ideally I'd be able to embed output from tests or benchmarks into the book. A sort of half-way house between book + code and a workbook and a literate code-base.

Proposed Solution

No response

Notes

No response

@drdozer drdozer added the C-enhancement Category: Enhancement or feature request label Nov 25, 2024
@ehuss
Copy link
Contributor

ehuss commented Nov 25, 2024

There are several include mechanisms described in https://rust-lang.github.io/mdBook/format/mdbook.html#including-files, which support anchors and hiding.

@drdozer drdozer closed this as completed Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: Enhancement or feature request
Projects
None yet
Development

No branches or pull requests

2 participants