From 6ce6eeeedb681e867fabb7f8c4f4afc98f528863 Mon Sep 17 00:00:00 2001 From: Morten Olsen Date: Sun, 18 May 2025 21:18:05 +0200 Subject: [PATCH] docs: improved docs --- docs/README.md | 28 ++++++--------------------- docs/examples/_shared_requests.md | 3 +++ docs/examples/with-shared_requests.md | 18 +++++++++++++++++ 3 files changed, 27 insertions(+), 22 deletions(-) create mode 100644 docs/examples/_shared_requests.md create mode 100644 docs/examples/with-shared_requests.md diff --git a/docs/README.md b/docs/README.md index 62190d9..a5ad457 100644 --- a/docs/README.md +++ b/docs/README.md @@ -209,34 +209,18 @@ The requests from the embedded document are processed, and their `request` and ` Assume `_shared_requests.md` contains: -````markdown -```http id=sharedGetRequest -GET https://httpbin.org/get -``` -```` +::raw-md[./examples/_shared_requests.md] Then, in `main.md`: -````markdown -# Main Document +::raw-md[./examples/with-template.md] -Let's include some shared requests: +
+ Output -::md[./_shared_requests.md] +::raw-md[./examples/with-template.md]{render} -The shared GET request returned: {{responses.sharedGetRequest.status}} - -Now, a request specific to this document: - -```http -POST https://httpbin.org/post -Content-Type: application/json - -{"dataFromMain": "someValue", "sharedUrl": "{{requests.sharedGetRequest.url}}"} -``` - -::response -```` +
When `main.md` is processed, `_shared_requests.md` will be embedded, its `sharedGetRequest` will be executed, and its data will be available for templating. diff --git a/docs/examples/_shared_requests.md b/docs/examples/_shared_requests.md new file mode 100644 index 0000000..e806fd3 --- /dev/null +++ b/docs/examples/_shared_requests.md @@ -0,0 +1,3 @@ +```http #sharedGetRequest +GET https://httpbin.org/get +``` diff --git a/docs/examples/with-shared_requests.md b/docs/examples/with-shared_requests.md new file mode 100644 index 0000000..455ef5e --- /dev/null +++ b/docs/examples/with-shared_requests.md @@ -0,0 +1,18 @@ +# Main Document + +Let's include some shared requests: + +::md[./_shared_requests.md] + +The shared GET request returned: + +Now, a request specific to this document: + +```http +POST https://httpbin.org/post +Content-Type: application/json + +{"dataFromMain": "someValue", "sharedUrl": ""} +``` + +::response