在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):campoy/embedmd开源软件地址(OpenSource Url):https://github.com/campoy/embedmd开源编程语言(OpenSource Language):Go 97.9%开源软件介绍(OpenSource Introduction):embedmdAre you tired of copy pasting your code into your Then
The command receives a list of Markdown files. If no list is given, the command reads from the standard input. The format of an [embedmd]:# (pathOrURL language /start regexp/ /end regexp/) The embedded code will be extracted from the file at Omitting the the second regular expression will embed only the piece of text
that matches [embedmd]:# (pathOrURL language /regexp/) To embed the whole line matching a regular expression you can use: [embedmd]:# (pathOrURL language /.*regexp.*/) To embed from a point to the end you should use: [embedmd]:# (pathOrURL language /start regexp/ $) To embed a whole file, omit both regular expressions: [embedmd]:# (pathOrURL language) You can omit the language in any of the previous commands, and the extension of the file will be used for the snippet syntax highlighting. This works when the file extensions matches the name of the language (like Go
files, since [embedmd]:# (file.ext) Installation
This will download the code, compile it, and leave an Eventually, and if there's enough interest, I will provide binaries for every OS and architecture out there ... eventually. Usage:Given the two files in sample: hello.go: // Copyright 2016 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
package main
import (
"fmt"
"time"
)
func main() {
fmt.Println("Hello, there, it is", time.Now())
} docs.md: # A hello world in Go
Go is very simple, here you can see a whole "hello, world" program.
[embedmd]:# (hello.go)
We can try to embed a file from a directory.
[embedmd]:# (test/hello.go /func main/ $)
You always start with a `package` statement like:
[embedmd]:# (hello.go /package.*/)
Followed by an `import` statement:
[embedmd]:# (hello.go /import/ /\)/)
You can also see how to get the current time:
[embedmd]:# (hello.go /time\.[^)]*\)/) Flags
DisclaimerThis is not an official Google product (experimental or otherwise), it is just code that happens to be owned by Google. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论