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