Package Exports
- @igor.dvlpr/strip-yaml-front-matter
- @igor.dvlpr/strip-yaml-front-matter/dist/index.mjs
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@igor.dvlpr/strip-yaml-front-matter) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
--- Strip YAML front matter ---
π¦ Strips YAML front matter from a String or a file. πΎ
π Support further development
I work hard for every project, including this one and your support means a lot to me!
Consider buying me a coffee. β
Thank you for supporting my efforts! ππ
![]()
@igorskyflyer
π€ Introduction
YAML front matter is a special text/code block placed between two triple-dashed lines that is added to the top of a file, usually Markdown (.md
), sometimes even HTML (.html
) files and provides meta data about the given file or provide means to do additional processing of the file. It is mostly used by static site generators (SSG) or content management systems (CMS).
Here's an example Markdown file:
example.md
```yaml
author: John Doe publishDate: 27 Aug, 2024
Some Markdown content.
<br>
## π΅πΌ Usage
Install it by executing:
```shell
npm i "@igor.dvlpr/strip-yaml-front-matter"
π€ΉπΌ API
function stripString(content: string): string
Strips YAML front matter from a String.
content
:string
, the string whose YAML front matter to strip.
Returns the original String without the YAML front matter.
function stripFile(path: string): string
Strips YAML front matter from a file.
path
:string
, the path to the file.
[!WARNING] Will throw an error if the file path is not valid or the file cannot be read.
Returns the original file contents as a String without the YAML front matter.
πͺͺ License
Licensed under the MIT license which is available here, MIT license.
𧬠Related
πΌ Provides a way to check if the given path is the root drive/directory. β
π Provides recursive readdir() and readdirSync() functions. π
π¦ ExtendableString allows you to create strings on steroids that have custom transformations applied to them, unlike common, plain strings. πͺ
π An npm package for fetching Windows registry keys. π
π§ Zep is a zero-dependency, efficient debounce module. β°
Provided by Igor DimitrijeviΔ (@igorskyflyer).