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

features needed for Go snippet insertion #47

Open
jba opened this issue Mar 23, 2017 · 0 comments
Open

features needed for Go snippet insertion #47

jba opened this issue Mar 23, 2017 · 0 comments

Comments

@jba
Copy link

jba commented Mar 23, 2017

My application is inserting snippets from compilable Go code into a README.md. I wasn't able to use embedmd for a couple of reasons.

  • I want to exclude the matching regexps, so I can write comments in the Go code that delimit the snippet. I don't want to match the snippet code itself, because that is fragile—it can change. See support a flag to exclude matching lines #46.

  • I really want to exclude the line the regexp is on. Not a big deal, just add .* to the regexp, but I need to do that for every one, so it's a little error-prone.

  • The snippets are typically inside functions, so they have a leading tab. I need to remove this tab from each line so that my Markdown code blocks are not indented. No way to do this in the current embedmd model.

  • Another whitespace issue: at top-level, gofmt puts a blank line between code and a following comment. If that comment is an end-of-snippet delimiter, I need to drop that final blank line, or it will end up in my markdown. (I want to preserve blank lines inside the snippet, however.)

  • Sometimes one wants to write ... in a snippet as a placeholder. E.g.

    tokenSource := ...
    client = New(ctx, tokenSource)

    Since that isn't legal Go, I need something that will transform legal Go into it. E.g. replace ELLIPSIS and _ = ELLIPSIS with ....

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