Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/threema-ch/threema-markup
A markup parser and formatter for the markup language used in Threema.
https://github.com/threema-ch/threema-markup
Last synced: about 1 month ago
JSON representation
A markup parser and formatter for the markup language used in Threema.
- Host: GitHub
- URL: https://github.com/threema-ch/threema-markup
- Owner: threema-ch
- License: apache-2.0
- Created: 2021-01-18T09:44:03.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-10-07T08:20:50.000Z (about 2 years ago)
- Last Synced: 2024-11-11T16:52:13.952Z (about 1 month ago)
- Language: TypeScript
- Size: 59.6 KB
- Stars: 5
- Watchers: 5
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# threema-markup
[![CI][ci-badge]][ci]
A markup parser and formatter for the markup language used in Threema.
## Usage
The simplest way is to apply the `markify` function to text with markup.
```typescript
import {markify} from '@threema/threema-markup';const formatted = markify('*bold text with _italic_ *');
// Result: bold text with italic
```By default, the following CSS class mapping is used:
- Bold: `text-bold`
- Italic: `text-italic`
- Strikethrough: `text-strike`But this can be customized:
```typescript
import {TokenType, markify} from '@threema/threema-markup';const formatted = markify('*bold text with _italic_ *', {
[TokenType.Asterisk]: 'a',
[TokenType.Underscore]: 'u',
[TokenType.Tilde]: 't',
});
// Result: bold text with italic
```## Development
### Setup
npm install
## Building
npm run build
## Testing
npm test
## License
Licensed under either of
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
http://www.apache.org/licenses/LICENSE-2.0)
* MIT license ([LICENSE-MIT](LICENSE-MIT) or
http://opensource.org/licenses/MIT)at your option.
[ci]: https://github.com/threema-ch/threema-markup/actions?query=workflow%3ACI
[ci-badge]: https://img.shields.io/github/workflow/status/threema-ch/threema-markup/CI/main