Skip to content

Instantly share code, notes, and snippets.

@jefftriplett
Last active September 18, 2019 17:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jefftriplett/1fbb06e0185a0465097b0e12494da34f to your computer and use it in GitHub Desktop.
Save jefftriplett/1fbb06e0185a0465097b0e12494da34f to your computer and use it in GitHub Desktop.

Example of using modd and embedme

embedme is a great tool to keep external scripts in-sync with your docs.

*.md {
    prep +onchange: "npx embedme *.md"
}

*.py {
    prep +onchange: "black ."
}

Example of using for a project

My Dockerfile

FROM python:3.7

COPY hello.py /

CMD [ "python", "/hello.py" ]

My Python file

def main():
    print("oh hai")


if __name__ == "__main__":
    main()

So from the command line, to build this image, you'd run:

$ docker build . -t oh-hai

To run this image, you'd run:

$ docker run -it --rm oh-hai
FROM python:3.7
COPY hello.py /
CMD [ "python", "/hello.py" ]
def main():
print("oh hai")
if __name__ == "__main__":
main()
*.md {
prep +onchange: "npx embedme *.md"
}
*.py {
prep +onchange: "black ."
}
# this is optional but nice to preview Markdown
# {
# daemon: "npx vmd README.md"
# }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment