Skip to content

Commit

Permalink
Add README
Browse files Browse the repository at this point in the history
  • Loading branch information
statup-github committed Oct 13, 2022
1 parent affa836 commit 642395e
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 3 deletions.
46 changes: 44 additions & 2 deletions README.md
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
Binary file added assets/Screenshot 2022-10-14 001453.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion extend.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
// Extender allows you to use fenced divs / fenced containers / fences in markdown
//
// Fences are a way to wrap other elements in divs and giving those divs
// attributes using the same syntax as with headings.
// attributes such as ids or css classes using the same syntax as with headings.
//
// :::{#big-div .add-border}
// this is some text
Expand Down

0 comments on commit 642395e

Please sign in to comment.