frontmatter


Namefrontmatter JSON
Version 3.0.8 PyPI version JSON
download
home_pagehttps://github.com/jonbeebe/frontmatter
SummaryExtract YAML frontmatter from files and strings.
upload_time2024-03-08 07:55:51
maintainer
docs_urlNone
authorJonathan Beebe
requires_python
license
keywords yaml frontmatter front-matter markdown blogging
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            frontmatter
============

A simple Python package for parsing YAML Frontmatter from a text file or string. Written for Python 3, but should also work for Python 2.7.

Usage
------

```
from frontmatter import Frontmatter

# assuming 'testfile.md' exists
post = Frontmatter.read_file('testfile.md')

print(post['attributes'], "\n")  # Dictionary
print(post['body'], "\n")        # String
print(post['frontmatter'])       # String
```

The output would be:

```
{'foo': 'bar', 'num': 3, 'list': ['first', 'second', 'third']}

This is the actual post content
This is a second line

foo: bar
num: 3
list:
- first
- second
- third
```

In the above example, the contents of **testfile.md** is:

```
---
foo: bar
num: 3
list:
- first
- second
- third
---

This is the actual post content
This is a second line
```

LICENSE
--------

[ISC License](https://en.wikipedia.org/wiki/ISC_license)


Copyright (c) 2018, Jonathan Beebe

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/jonbeebe/frontmatter",
    "name": "frontmatter",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "yaml frontmatter front-matter markdown blogging",
    "author": "Jonathan Beebe",
    "author_email": "me@jonbeebe.net",
    "download_url": "https://files.pythonhosted.org/packages/8b/de/7425e1c97db39ca6615ccf89d8c3b47f2ee8dfdabb754fc99f925ee1a702/frontmatter-3.0.8.tar.gz",
    "platform": null,
    "description": "frontmatter\n============\n\nA simple Python package for parsing YAML Frontmatter from a text file or string. Written for Python 3, but should also work for Python 2.7.\n\nUsage\n------\n\n```\nfrom frontmatter import Frontmatter\n\n# assuming 'testfile.md' exists\npost = Frontmatter.read_file('testfile.md')\n\nprint(post['attributes'], \"\\n\")  # Dictionary\nprint(post['body'], \"\\n\")        # String\nprint(post['frontmatter'])       # String\n```\n\nThe output would be:\n\n```\n{'foo': 'bar', 'num': 3, 'list': ['first', 'second', 'third']}\n\nThis is the actual post content\nThis is a second line\n\nfoo: bar\nnum: 3\nlist:\n- first\n- second\n- third\n```\n\nIn the above example, the contents of **testfile.md** is:\n\n```\n---\nfoo: bar\nnum: 3\nlist:\n- first\n- second\n- third\n---\n\nThis is the actual post content\nThis is a second line\n```\n\nLICENSE\n--------\n\n[ISC License](https://en.wikipedia.org/wiki/ISC_license)\n\n\nCopyright (c) 2018, Jonathan Beebe\n\nPermission to use, copy, modify, and/or distribute this software for any\npurpose with or without fee is hereby granted, provided that the above\ncopyright notice and this permission notice appear in all copies.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\nWITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\nMERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\nANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\nWHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\nACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\nOR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Extract YAML frontmatter from files and strings.",
    "version": "3.0.8",
    "project_urls": {
        "Homepage": "https://github.com/jonbeebe/frontmatter"
    },
    "split_keywords": [
        "yaml",
        "frontmatter",
        "front-matter",
        "markdown",
        "blogging"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8bde7425e1c97db39ca6615ccf89d8c3b47f2ee8dfdabb754fc99f925ee1a702",
                "md5": "ad092952d339fe4336acec20960776ce",
                "sha256": "d913619d20f607e03557d52a8bf9b249e0b3093c770c5213c0f1231d2c97fe73"
            },
            "downloads": -1,
            "filename": "frontmatter-3.0.8.tar.gz",
            "has_sig": false,
            "md5_digest": "ad092952d339fe4336acec20960776ce",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 5254,
            "upload_time": "2024-03-08T07:55:51",
            "upload_time_iso_8601": "2024-03-08T07:55:51.023168Z",
            "url": "https://files.pythonhosted.org/packages/8b/de/7425e1c97db39ca6615ccf89d8c3b47f2ee8dfdabb754fc99f925ee1a702/frontmatter-3.0.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-08 07:55:51",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "jonbeebe",
    "github_project": "frontmatter",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "frontmatter"
}
        
Elapsed time: 0.20095s