fix(documentation): Improved and updated README with detailed usage instructions

This commit is contained in:
Philipp Kunz 2025-01-24 02:03:07 +01:00
parent a11b4ee7df
commit 4c6e1e9c47
6 changed files with 42 additions and 71 deletions

View File

@ -1,63 +0,0 @@
# @push.rocks/smartfm
frontmatter done right
> Please consider following us on https://beta.news/lossless to subscribe to infos on changes and updates.
## Availabililty and Links
* [npmjs.org (npm package)](https://www.npmjs.com/package/@push.rocks/smartfm)
* [gitlab.com (source)](https://gitlab.com/pushrocks/smartfm)
* [github.com (source mirror)](https://github.com/pushrocks/smartfm)
* [docs (typedoc)](https://pushrocks.gitlab.io/smartfm/)
## Status for master
[![build status](https://gitlab.com/pushrocks/smartfm/badges/master/build.svg)](https://gitlab.com/pushrocks/smartfm/commits/master)
[![coverage report](https://gitlab.com/pushrocks/smartfm/badges/master/coverage.svg)](https://gitlab.com/pushrocks/smartfm/commits/master)
[![npm downloads per month](https://img.shields.io/npm/dm/@push.rocks/smartfm.svg)](https://www.npmjs.com/package/@push.rocks/smartfm)
[![Known Vulnerabilities](https://snyk.io/test/npm/@push.rocks/smartfm/badge.svg)](https://snyk.io/test/npm/@push.rocks/smartfm)
[![TypeScript](https://img.shields.io/badge/TypeScript->=%203.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
[![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-prettier-ff69b4.svg)](https://prettier.io/)
## Usage
We recommend TypeScript for best in class Intellisense.
```javascript
import * as smartfm from * smartfm
let markdownfile = `---
testKey: testValue
testKey2: testValue2
---
# some markdown`
// easy methods
let parsedData = smartfm.parse(markdownfile)
// parsedData will be object
/*
{
data: {
testKey: testValue,
testKey2: testValue2
},
content: '# some markdown',
orig: '---\ntestKey: testValue\ntestKey2: testValue2\n---\n# some markdown'
}
*/
let newFmString = smartfm.stringify('My awesome string', {testKey1: testValue1})
// newFmString will be '---\testKey1: testValue1\n---\nMyawesomeString'
# class Smartfm
let mySmartfm = new smartfm.Smartfm({
fmType: 'yaml' // can be yaml or json atm
})
```
For further information read the linked docs at the top of this readme.
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
[![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com)

View File

@ -1,5 +1,12 @@
# Changelog
## 2025-01-24 - 2.1.1 - fix(documentation)
Improved and updated README with detailed usage instructions
- Replaced placeholder text in README with complete usage guide
- Added comprehensive examples for parsing and stringifying frontmatter data
- Included detailed instructions on how to install and use the Smartfm class
## 2025-01-23 - 2.1.0 - feat(ci)
Introduce new CI workflows for Gitea and remove GitLab CI

View File

@ -9,9 +9,24 @@
"githost": "code.foss.global",
"gitscope": "push.rocks",
"gitrepo": "smartfm",
"description": "frontmatter done right",
"description": "A Node.js module for handling and processing frontmatter in markdown and text files, leveraging the gray-matter library for parsing and stringifying YAML or JSON formatted frontmatter.",
"npmPackagename": "@push.rocks/smartfm",
"license": "MIT"
"license": "MIT",
"keywords": [
"frontmatter",
"markdown",
"text files",
"YAML",
"JSON",
"stringify",
"parse",
"commented sections",
"static site generator",
"CMS",
"content metadata",
"metadata management",
"gray-matter"
]
}
},
"tsdoc": {

View File

@ -2,7 +2,7 @@
"name": "@push.rocks/smartfm",
"version": "2.1.0",
"private": false,
"description": "frontmatter done right",
"description": "A Node.js module for handling and processing frontmatter in markdown and text files, leveraging the gray-matter library for parsing and stringifying YAML or JSON formatted frontmatter.",
"exports": {
".": "./dist/index.js"
},
@ -17,7 +17,19 @@
"url": "git+https://code.foss.global/push.rocks/smartfm.git"
},
"keywords": [
"frontmatter"
"frontmatter",
"markdown",
"text files",
"YAML",
"JSON",
"stringify",
"parse",
"commented sections",
"static site generator",
"CMS",
"content metadata",
"metadata management",
"gray-matter"
],
"author": "Lossless GmbH",
"license": "MIT",
@ -47,4 +59,4 @@
"npmextra.json",
"readme.md"
]
}
}

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@push.rocks/smartfm',
version: '2.1.0',
description: 'frontmatter done right'
version: '2.1.1',
description: 'A Node.js module for handling and processing frontmatter in markdown and text files, leveraging the gray-matter library for parsing and stringifying YAML or JSON formatted frontmatter.'
}

View File

@ -31,7 +31,7 @@ export class Smartfm {
}
/**
* parse from commnets
* parse from comments
*/
parseFromComments(commentStart: string, stringToParse: string) {
const diffFunc = (diffMe, diffBy) => diffMe.split(diffBy).join('');