Skip to content

Commit

Permalink
feat: recursive link processing for url and repo_url (#23)
Browse files Browse the repository at this point in the history
* Updating processing the url and repo_url (#22)

* update (includes.py): path processing

* upgate (includes.py): update processing repo_url

* update: add test

* update (readme.md): add note for repo_url

* update readme and test

* resolve conflict

* update: deleted print

* fix: added error handling

* fix: full links

Co-authored-by: Екатерина Московская <[email protected]>

* update: bump version to 1.1.15

* fix (docs): minor fixes

* fix: style errors

Co-authored-by: Ekaterina <[email protected]>
Co-authored-by: Екатерина Московская <[email protected]>
  • Loading branch information
3 people authored Jan 23, 2023
1 parent 333b08e commit a377699
Show file tree
Hide file tree
Showing 5 changed files with 191 additions and 73 deletions.
43 changes: 34 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,28 @@ Text below is taken from a remote repository on branch develop.
<include repo_url="https://github.com/foo/bar.git" revision="develop" path="path/to/doc.md"></include>
```

To include a text from HTTP(S) URL use the `url` attributes:

```markdown
Text below is taken from a remote repository on the default branch.
<include url="https://github.com/foo/bar/path/to/doc.md"></include>
```

> **Note**
>
> For projects in GitHub, you must specify the full path to the raw file, while not specifying the file extension `.md`.

``` markdown
<include url="https://github.com/path/to/doc/raw/master/doc" nohead="true"></include>
```

> For projects in GitLab, you must specify the full path to the raw file, and you must specify the file extension `.md`.

```markdown
<include url="https://gitlub.com/path/to/doc/raw/master/doc.md" nohead="true"></include>
```

To include a code snippet, use `wrap_code` and `code_language` attributes:

```markdown
Expand All @@ -118,8 +140,6 @@ wrap_code="triple_backticks" code_language="yaml">
</include>
```



#### Attributes

`src`
Expand All @@ -134,13 +154,18 @@ wrap_code="triple_backticks" code_language="yaml">
`path`
: Path to the file inside the remote Git repository.

> **Note**
>
> If you are using the new syntax, the `src` attribute is required to include a local file, `url` is required to include a remote file, and the `repo_url` and `path` attributes are required to include a file from a remote Git repository. All other attributes are optional.
> **Note**
>
> Path parameter is required!
Its absence will lead to incorrect operation Foliant.

> **Note**
>
> Foliant 1.0.9 supports the processing of attribute values as YAML. You can precede the values of attributes by the `!path`, `!project_path`, and `!rel_path` modifiers (i.e. YAML tags). These modifiers can be useful in the `src`, `path`, and `project_root` attributes.
> **Note**
>
> If you are using the new syntax, the `src` attribute is required to include a local file, `url` is required to include a remote file, and the `repo_url` and `path` attributes are required to include a file from a remote Git repository. All other attributes are optional.

> **Note**
>
> Foliant 1.0.9 supports the processing of attribute values as YAML. You can precede the values of attributes by the `!path`, `!project_path`, and `!rel_path` modifiers (i.e. YAML tags). These modifiers can be useful in the `src`, `path`, and `project_root` attributes.

`revision`
: Revision of the Git repository.
Expand Down Expand Up @@ -280,4 +305,4 @@ Include content from “Intro” up to the next heading of the same level:
<include>sample.md#Intro</include>
```

In the legacy syntax, problems may occur with the use of `$`, `#`, and `:` characters in filenames and headings, since these characters may be interpreted as delimeters.
In the legacy syntax, problems may occur with the use of `$`, `#`, and `:` characters in filenames and headings, since these characters may be interpreted as delimiters.
5 changes: 5 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 1.1.15

- Feat: recursive link processing for _url_ and _repo_url_


# 1.1.14

- Fix `image_pattern` for `adjust_image_paths` method
Expand Down
Loading

0 comments on commit a377699

Please sign in to comment.