# HG changeset patch # User Steve Losh # Date 1598588489 14400 # Node ID 4a90d30e1c1771458d8b2e312d3d9f7636179eb1 # Parent 49612dd94ae1270c9a2183afab7274f9339ca18d Add basic support for static assets/media diff -r 49612dd94ae1 -r 4a90d30e1c17 d/base.py --- a/d/base.py Tue Jan 14 20:06:16 2020 -0500 +++ b/d/base.py Fri Aug 28 00:21:29 2020 -0400 @@ -235,6 +235,13 @@ for filename in os.listdir(resources): shutil.copyfile(j(resources, filename), j(destination, '_dmedia', filename)) + static_source = j(source, 'static') + if os.path.isdir(static_source): + static_destination = j(destination, 'static') + if os.path.isdir(static_destination): + shutil.rmtree(static_destination) + shutil.copytree(static_source, static_destination) + chapters = [] for filename in _find_chapters(source): chapter_title = _render(title, CONTENT_PRE, footer, diff -r 49612dd94ae1 -r 4a90d30e1c17 docs/04-faqs.markdown --- a/docs/04-faqs.markdown Tue Jan 14 20:06:16 2020 -0500 +++ b/docs/04-faqs.markdown Fri Aug 28 00:21:29 2020 -0400 @@ -98,9 +98,19 @@ Sure. Remember that Markdown lets you add raw HTML anywhere. Just put the HTML in `footer.markdown` and you're all set. -### Can I add media? +### Can I add static assets/media? + +Yes, if there's a directory named `static` in your documentation source +directory it will be copied into the output. -Not yet, but it's on my radar. +For example, you could have `static/foo.png` in your documentation directory and +then put the following into your Markdown: + + ![A picture of the elusive Foo](../static/foo.png) + +If you want to linkify the image, Just Use Markdown™: + + [![A picture of the elusive Foo](../static/foo.png)](../static/foo.png) ### Can I display a table of contents for a single page?