Named snippets dynamically imported from external Git repo #231
machty
started this conversation in
Feature Requests
Replies: 1 comment
-
What is the best way to insert code snippets into Gitbook while maintaining an ever-changing code base? Currently, I copy and paste and make mistakes. Can something like this be done?
Where the name is a unique name for the block, and lang is the programming lang the code is in And on Gitbook, I should be able to paste something like
And this will provide the same function as , but the code will be synced to git. Thoughts ? Jay |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
What's your feature/idea?
A lot of Google's docs use code snippets that are extracted from an actual Git repository of code, e.g. this page in their MLKit docs uses snippets from this file in a Github repo.
They even allow multiple file names, e.g. Kotlin and Java, to declare the same snippet name, and the code snippets are grouped together in a language selector tab:
In order for this to work, you have to put START/END comments in your codebase with the name of the snippet. There are many benefits to this:
What's your desired outcome?
Gitbook provides some feature by which an external database that serves as a snippet source can be linked to the account, and adds UI for adding snippets to gitbook docs via snippet name.
What's the impact of this for you?
Anything else?
No response
Beta Was this translation helpful? Give feedback.
All reactions