Skip to content

Commit

Permalink
feat: add symbol embeds and listing (#1126)
Browse files Browse the repository at this point in the history
  • Loading branch information
hugomrdias authored Sep 1, 2020
1 parent e01242c commit 847b49c
Show file tree
Hide file tree
Showing 12 changed files with 260 additions and 401 deletions.
38 changes: 31 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,36 @@ You can override the `<a>` title by passing a second `string` in the link defini


## Shortcodes

### `embed`
```md
# src relative to the page
{{<embed src="piece_store.id" lang="go">}}

# src relative to content folder
{{<embed src="/systems/piece_store.id" lang="go">}}

# can just embed a markdown file
{{<embed src="section.md" markdown="true">}}

# can embed symbols from Go files
# extracts comments and symbol body
{{<embed src="/externals/go-data-transfer/types.go" lang="go" symbol="Channel">}}
```

### `listing`
The listing shortcode creates tables from externals sources, supports Go `struct`.
```md
# src relative to the page
{{<listing src="piece_store.go" symbol="Channel">}}

# src relative to content folder
{{<listing src="/systems/piece_store.go" symbol="Channel">}}

# src can also be from the externals repos
{{<listing src="/externals/go-data-transfer/types.go" symbol="Channel">}}
```

### `Mermaid`
Inline mermaid syntax rendering
```html
Expand All @@ -209,14 +239,8 @@ Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat
stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa
{{< /hint >}}
```
### `embed`
```md
# src relative to the page
{{<embed src="piece_store.id" lang="go">}}

# src relative to content folder
{{<embed src="/systems/piece_store.id" lang="go">}}
```


## Math mode
For short snippets of math text you can just use the `{{<katex>}}` shortcode, but if you need to write lots of math in a page you can just use `math-mode` and avoid writting the katex shortcode everywhere.
Expand Down
5 changes: 3 additions & 2 deletions assets/_code.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.markdown pre {
max-height: 450px;
overflow: auto;
// max-height: 450px;
// overflow: auto;

}
Loading

0 comments on commit 847b49c

Please sign in to comment.