Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions docs/userGuide/syntax/includes.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,62 @@ The `<include>` mechanism can be used inside any MarkBind source file (even insi
</span>
</include>

<panel header="Markdown not rendered when including a variable">

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The heading should let the reader decide quickly between expanding and reading the panel or skipping it. This one is hard to decide (is this a tip, advanced technique, caveat, etc.?), and the reader will have to expand the panel to figure out what it's about.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm how about "If trying to include a variable with markdown" or something like that?


When trying to include a variable, markdown is not rendered.

To fix this, either replace the markdown with html tags if possible or replace the `include` with the fragment.

{{ icon_example }}

<box>

Include fragment in file "index.md":
```html
<variable id="fragment-id">

### I am a header
</variable>
```

Code that uses include fragment:
```html
<include src="index.md#fragment-id" />
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something is not right here. I don't think variables are meant to be used as include fragments in the first place. Although it would be nice 'trick' to be able to do so, I don't think it is an advertised feature. Variable values are inserted using the {{ v_name }} instead. Does our UG say variables can be included in this way?

image

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see I see. In that case, I will close this PR and the corresponding issue :)


The markdown will not render correctly and instead will appear as text '### I am a header'.
</box>

To fix this, either replace the markdown with html tags if possible or replace the `include` with the fragment.

{{ icon_example }} Replacing markdown with html tags:

<box>

Include fragment in file "index.md":
```html
<variable id="fragment-id">
<h3>I am a header<h3>
</variable>
```

Code that uses include fragment:
```html
<include src="index.md#fragment-id" />
```
</box>

{{ icon_example }} Replacing the `include` with the fragment:

<box>
Code that is supposed to use include fragment:

```html
### I am a header
```
</box>
</panel>

**Attributes:**
* **`src`**: specify the source file path.
* **`inline`** (optional): make the included result an inline element. (wrapped in `<span>` tag). e.g.,
Expand Down