# emdbed Embed "things" in your markdown files. Given the same input, `emdbed` should give idempotent results. To create an `emdbed` section, use a header and footer as follows ```text ``` **NOTE:** The above snippet has an extra space at the end in order to keep it from recognizing the footer when generating this README. The regex is [Go flavored](https://golang.org/s/re2syntax), which you can test on [regex101](https://regex101.com/). ## Examples The following are generated using [readme.go](readme.go) and `go generate ./...`. Check the raw markdown for the header selectors used. An entire file: ```go // Package emdbed is for embedding "things" in your markdown package emdbed import ( "fmt" ) func Example() { fi, err := testdata.Open("testdata/main.md") defer fi.Close() out, err := Convert("testdata", fi) if err != nil { panic(err) } fmt.Println(out) // Output: // //```go //package main // //import "fmt" // //func main() { // fmt.Println("Hello, world!") //} // // ``` // } ``` Just the package: ```go package emdbed ``` Package line until the end of imports: ```go package emdbed import ( "fmt" ) ``` Only the example func ```go func Example() { fi, err := testdata.Open("testdata/main.md") defer fi.Close() out, err := Convert("testdata", fi) if err != nil { panic(err) } fmt.Println(out) // Output: // //```go //package main // //import "fmt" // //func main() { // fmt.Println("Hello, world!") //} // // ``` // } ``` A file in another directory (choosing/overriding the language) ```go package main import "fmt" func main() { fmt.Println("This file has no extension") } ``` ## License [MIT](LICENSE)