Skip to content

Commit 6187011

Browse files
author
Deyan Ginev
committed
Updates for XML support.
1 parent e90dc27 commit 6187011

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

README.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ A tool for injecting code snippets into MarkDown files:
88
`mdinject --root=<path-to-source-code> --docsroot=<path-to-docs>`
99

1010
# Using `markdown-snippet-injector`
11+
12+
## Defining snippets in `JavaScript` and `TypeScript` source files
13+
1114
Defining code snippets in your source files is done by enclosing them as shown below:
1215

1316
```
@@ -30,7 +33,29 @@ export function divide(a, b){
3033
// << division-snippet
3134
```
3235

33-
Then use the `<snippet id='<your-snippet-id'/>` notation to define the corresponding placeholders in your markdown files. They will be replaced by the snippet injector when run:
36+
## Defining source snippets in `XML` files
37+
If you want to define a code-snippet in a `XML` file you should use the following approach:
38+
39+
```XML
40+
<!-- >> listview-first-look -->
41+
<navigation:ExamplePage xmlns:navigation="navigation/example-page" loaded="onPageLoaded" xmlns:lv="nativescript-telerik-ui/listview" xmlns="http://www.nativescript.org/tns.xsd">
42+
<lv:RadListView items="{{ dataItems }}" >
43+
<lv:RadListView.listViewLayout>
44+
<lv:ListViewLinearLayout scrollDirection="Vertical"/>
45+
</lv:RadListView.listViewLayout>
46+
<lv:RadListView.itemTemplate>
47+
<StackLayout orientation="vertical">
48+
<Label fontSize="20" text="{{ itemName }}"/>
49+
<Label fontSize="14" text="{{ itemDescription }}"/>
50+
</StackLayout>
51+
</lv:RadListView.itemTemplate>
52+
</lv:RadListView>
53+
</navigation:ExamplePage>
54+
<!-- << listview-first-look -->
55+
```
56+
57+
## Defining placeholders for the snippets in your `MarkDown` files
58+
Use the `<snippet id='<your-snippet-id>'/>` notation to define the corresponding placeholders in your markdown files. They will be replaced by the snippet injector when run:
3459

3560
```MarkDown
3661
# Using the multiply function:

0 commit comments

Comments
 (0)