From dcfe317506f694f9954273c839ce0ccd912c3d1a Mon Sep 17 00:00:00 2001 From: Wedge Jarrad Date: Fri, 19 Jul 2024 09:33:43 -0700 Subject: [PATCH] Add download link example --- docs/examples/download.md | 24 ++++++++++++++++++++++++ docs/examples/files/sample1.py | 5 +++++ docs/index.md | 1 + 3 files changed, 30 insertions(+) create mode 100644 docs/examples/download.md create mode 100644 docs/examples/files/sample1.py diff --git a/docs/examples/download.md b/docs/examples/download.md new file mode 100644 index 000000000..43e214209 --- /dev/null +++ b/docs/examples/download.md @@ -0,0 +1,24 @@ +# Download Links + +## Overview + +This page shows how you can create a link that will cause a file to be +downloaded when clicked. + +## Example + +Here is an example: + +[Hello world code sample](./files/sample1.py){: download="hello.py"} + +## Markdown + +Here is the Markdown: + +```MD +[Hello world code sample](./files/sample1.py){: download="hello.py"} +``` + +Note that the name specified after `download=` is the name the file will be +given when it is downloaded. This does not need to be the same as the name of +the file on the server side. diff --git a/docs/examples/files/sample1.py b/docs/examples/files/sample1.py new file mode 100644 index 000000000..eee71a7db --- /dev/null +++ b/docs/examples/files/sample1.py @@ -0,0 +1,5 @@ +#!/usr/bin/env python +# vim: ts=4 sw=4 et + +if __name__ == '__main__': + print('Hello world!') diff --git a/docs/index.md b/docs/index.md index 6ab12961d..31c10b73e 100644 --- a/docs/index.md +++ b/docs/index.md @@ -8,6 +8,7 @@ This set of documentation is intended to show simple working examples of TechDoc Current examples: +- [Download Links](./examples/download.md): this shows how you can create a link that will cause a file to be downloaded - [iframe](./examples/iframe.md): this shows how you can use an iframe in your TechDocs - [Lists](./examples/lists.md): this showcases how to setup your lists in TechDocs - [Mermaid](./examples/mermaid.md): this showcases how to use Mermaid diagrams in your TechDocs