fix: correct code langs (#708)

This commit is contained in:
Stephen Zhou
2026-03-16 15:28:32 +08:00
committed by GitHub
parent a958852d8d
commit 5df20ab29d
22 changed files with 70 additions and 70 deletions

View File

@@ -83,7 +83,7 @@ To implement subscription creation via manual URL pasting, you need to modify tw
<Tab title="github.yaml">
Since GitHub webhooks use an encryption mechanism, a secret key is required to decrypt and validate incoming requests. Therefore, you need to declare `webhook_secret` in `github.yaml`.
```YAML
```yaml
subscription_schema:
- name: "webhook_secret"
type: "secret-input"
@@ -112,7 +112,7 @@ To implement subscription creation via manual URL pasting, you need to modify tw
For the complete code sample, see [Dify's GitHub trigger plugin](https://github.com/langgenius/dify-plugin-sdks/tree/feat/trigger/python/examples/github_trigger).
</Tip>
```Python
```python
class GithubTrigger(Trigger):
"""Handle GitHub webhook event dispatch."""
@@ -141,7 +141,7 @@ Taking the Issue event as an example, you can define the event and its implement
<Tabs>
<Tab title="issues.yaml">
```YAML
```yaml
identity:
name: issues
author: langgenius
@@ -167,7 +167,7 @@ Taking the Issue event as an example, you can define the event and its implement
```
</Tab>
<Tab title="issues.py">
```Python
```python
from collections.abc import Mapping
from typing import Any
@@ -205,7 +205,7 @@ To filter out certain events—for example, to focus only on Issue events with a
<Tabs>
<Tab title="issues.yaml">
```YAML
```yaml
parameters:
- name: added_label
label:
@@ -221,7 +221,7 @@ To filter out certain events—for example, to focus only on Issue events with a
```
</Tab>
<Tab title="issues.py">
```Python
```python
def _check_added_label(self, payload: Mapping[str, Any], added_label_param: str | None) -> None:
"""Check if the added label matches the allowed labels"""
if not added_label_param:
@@ -256,7 +256,7 @@ To enable automatic subscription creation via OAuth or API key, you need to modi
<Tab title="github.yaml">
In `github.yaml`, add the following fields.
```YAML
```yaml
subscription_constructor:
parameters:
- name: "repository"
@@ -307,7 +307,7 @@ To enable automatic subscription creation via OAuth or API key, you need to modi
<Tab title="github.py">
In `github.py`, create a `Constructor` class to implement the automatic subscription logic.
```Python
```python
class GithubSubscriptionConstructor(TriggerSubscriptionConstructor):
"""Manage GitHub trigger subscriptions."""
def _validate_api_key(self, credentials: Mapping[str, Any]) -> None:
@@ -394,7 +394,7 @@ The interface definitions and implementation methods of core classes in trigger
### Trigger
```Python
```python
class Trigger(ABC):
@abstractmethod
def _dispatch_event(self, subscription: Subscription, request: Request) -> EventDispatch:
@@ -431,7 +431,7 @@ class Trigger(ABC):
### TriggerSubscriptionConstructor
```Python
```python
class TriggerSubscriptionConstructor(ABC, OAuthProviderProtocol):
# OPTIONAL
def _validate_api_key(self, credentials: Mapping[str, Any]) -> None:
@@ -594,7 +594,7 @@ class TriggerSubscriptionConstructor(ABC, OAuthProviderProtocol):
### Event
```Python
```python
class Event(ABC):
@abstractmethod
def _on_event(self, request: Request, parameters: Mapping[str, Any], payload: Mapping[str, Any]) -> Variables:

View File

@@ -20,7 +20,7 @@ title: Local Source Code Start
### Clone Dify Repository
Run the git command to clone the [Dify repository](https://github.com/langgenius/dify).
```Bash
```bash
git clone https://github.com/langgenius/dify.git
```
@@ -28,7 +28,7 @@ git clone https://github.com/langgenius/dify.git
A series of middlewares for storage (e.g. PostgreSQL / Redis / Weaviate (if not locally available)) and extended capabilities (e.g. Dify's [sandbox](https://github.com/langgenius/dify-sandbox) and [plugin-daemon](https://github.com/langgenius/dify-plugin-daemon) services) are required by Dify backend services. Start the middlewares with Docker Compose by running these commands:
```Bash
```bash
cd docker
cp middleware.env.example middleware.env

View File

@@ -6,7 +6,7 @@ When developing the backend separately, you may only need to start the backend s
#### Pull the Docker image for the frontend service from DockerHub:
```Bash
```bash
docker run -it -p 3000:3000 -e CONSOLE_URL=http://127.0.0.1:5001 -e APP_URL=http://127.0.0.1:5001 langgenius/dify-web:latest
```

View File

@@ -131,7 +131,7 @@ Iteration nodes output arrays that often need conversion for final use:
</Tab>
<Tab title="Using Template Node">
```jinja2
```jinja
{{ articleSections | join("\n") }}
```

View File

@@ -112,7 +112,7 @@ The default variable selector for vision is `userinput.files` which automaticall
LLM prompts support Jinja2 templating for advanced variable handling. When you use Jinja2 mode (`edition_type: "jinja2"`), you can:
```jinja2
```jinja
{% for item in search_results %}
{{ loop.index }}. {{ item.title }}: {{ item.content }}
{% endfor %}

View File

@@ -18,7 +18,7 @@ Template nodes use Jinja2 templating syntax to create dynamic content that adapt
Reference workflow variables using double curly braces: `{{ variable_name }}`. You can access nested object properties and array elements using dot notation and bracket syntax.
```jinja2
```jinja
{{ user.name }}
{{ items[0].title }}
{{ data.metrics.score }}
@@ -28,7 +28,7 @@ Reference workflow variables using double curly braces: `{{ variable_name }}`. Y
Show different content based on data values using if-else statements:
```jinja2
```jinja
{% if user.subscription == 'premium' %}
Welcome back, Premium Member! You have access to all features.
{% else %}
@@ -40,7 +40,7 @@ Consider upgrading to Premium for additional capabilities.
Process arrays and objects with for loops to generate repetitive content:
```jinja2
```jinja
{% for item in search_results %}
### Result {{ loop.index }}
**Score**: {{ item.score | round(2) }}
@@ -59,7 +59,7 @@ Process arrays and objects with for loops to generate repetitive content:
Jinja2 filters transform data during template rendering:
```jinja2
```jinja
{{ name | upper }}
{{ price | round(2) }}
{{ content | replace('\n', '<br>') }}
@@ -71,7 +71,7 @@ Jinja2 filters transform data during template rendering:
Handle missing or invalid data gracefully using default values and conditional checks:
```jinja2
```jinja
{{ user.email | default('No email provided') }}
{{ metrics.accuracy | round(2) if metrics.accuracy else 'Not calculated' }}
```

View File

@@ -120,7 +120,7 @@ Alternatively, you can send a test request to the webhook trigger and check the
- Example: From the following request body, you can extract the `customerName` (`Alex`), the list of items, or the `isPriority` status (`true`).
```JSON
```json
"customerName": "Alex",
"items":
[

View File

@@ -230,7 +230,7 @@ Since the Dify cloud version cannot access internal network API services, you ca
![Download](https://assets-docs.dify.ai/dify-enterprise-mintlify/zh_CN/guides/extension/api-based-extension/c44d6cc5425508daac8d31bc4af113df.png)
2. After downloading, go to the download directory, extract the archive according to the instructions below, and execute the initialization script in the instructions.
```Shell
```shell
unzip /path/to/ngrok.zip
./ngrok config add-authtoken your-token
```
@@ -240,7 +240,7 @@ Since the Dify cloud version cannot access internal network API services, you ca
And run the following command to start:
```Shell
```shell
./ngrok http port-number
```