-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
affa836
commit 642395e
Showing
3 changed files
with
45 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,44 @@ | ||
# goldmark-fences | ||
Fenced divs for the Goldmark go markdown renderer | ||
# Goldmark-Fences | ||
|
||
## Overview | ||
|
||
[Goldmark](github.com/yuin/goldmark) is a fast markdown renderer for Go. Fences are a markdown extension that allows you to wrap parts of a markdown in a `<div>` or other html-tag with custom classes, ids or other html attributes. | ||
|
||
Fences are also called "fenced divs" or "fenced containers." I will use fences because it's the shortest of the available options. | ||
|
||
### An Example | ||
|
||
```markdown | ||
:::{.blue} | ||
## Life Inside Fences | ||
|
||
We are now inside a div with the css-class "blue". This can be used to style this block | ||
|
||
:::{#insideme .red data="important"} | ||
fences can be nested and given ids as well as classes | ||
::: | ||
::: | ||
``` | ||
|
||
Now add the css to your stylesheet: | ||
|
||
```css | ||
.blue { background-color: steelblue; padding: 5px; } | ||
#insideme { color: yellow; } | ||
.red { background-color: red; } | ||
``` | ||
|
||
And the fenced part will look like this (this is an image as github doesn't allow custom css in READMEs): | ||
|
||
![](assets/Screenshot%202022-10-14%20001453.png) | ||
|
||
## Possible Use Cases | ||
|
||
You can use fences to e.g. | ||
|
||
* style your output | ||
* wrap semantic units into blocks - e.g. put your toc into one div - which allows you to... | ||
* move parts outside the normal layout - e.g. create a floating toc on the left | ||
* fulfill the requirements of third party libs regarding attributes like `data=` etc. | ||
* use it for other extensions -- e.g. to wrap all sections in divs for a semantic output structure | ||
* create random html creations |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters