-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from render-engine/kjaymiller-update-readme
Update README.md
- Loading branch information
Showing
1 changed file
with
45 additions
and
4 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,9 +1,50 @@ | ||
# Render Engine Parsers | ||
|
||
The page parser system used for making content for Render Engine | ||
The page parser system used for making content for Render Engine. Parsers are used to parse the content of a page and convert it to HTML. The parser is specified in the page attributes as `Parser`. | ||
|
||
## Parsers | ||
This is meant to be used by Render Enging but can be used as a base dependency for building custom Render Engine Parsers. | ||
|
||
Parsers are used to parse the content of a page and convert it to HTML. The parser is specified in the page attributes as `Parser`. | ||
## Using Frontmatter | ||
|
||
The default parser is the `BasePageParser` which processes markdown and passes the content thru as plain text. | ||
[Frontmatter](https://github.com/eyeseast/python-frontmatter) is used to pull in attributes from a generated page. | ||
|
||
Some pages will be looking for information that is provided in the frontmatter. All of the attributes defined can be used in the template (which itself can also be defined in the frontmatter or the class itself. | ||
|
||
> **NOTE** | ||
> These attributes **CANNOT** be used in the content itself, but you can use them in the template generation. | ||
```md | ||
--- | ||
title: "Spider-Man" | ||
name: "Peter Parker" | ||
superhero: "Spider-Man" | ||
--- | ||
|
||
<h2>I'm your friendly neighborhood Spiderman</h2> | ||
|
||
<p>I was bitten by a radioactive spider and now I fight crime.</p> | ||
``` | ||
|
||
If you generate the page with the following template | ||
|
||
```html | ||
<h1>About {{superhero}}</h1> | ||
<h2>Real Name: {{alias}}</h2> | ||
|
||
<div> | ||
{{content}} | ||
</div> | ||
``` | ||
|
||
it would generate. | ||
|
||
```html | ||
<h1>About Spider-Man</h1> | ||
<h2>Alias: Peter Parker</h2> | ||
|
||
<div> | ||
<h2>I'm your friendly neighborhood Spiderman</h2> | ||
|
||
<p>I was bitten by a radioactive spider and now I fight crime.</p> | ||
</div> | ||
``` |