bionic-reading
An Open-Source JavaScript Implementation of Bionic Reading API.
⚙️
Install
npm i bionic-reading
yarn add bionic-reading # or Yarn
pnpm add bionic-reading # or Pnpm
📖
Usage
ESM (Browser)
import { bionicReading } from 'bionic-reading';
const text =
'Bionic Reading is a new method facilitating the reading process by guiding the eyes through text with artificial fixation points. As a result, the reader is only focusing on the highlighted initial letters and lets the brain center complete the word. In a digital world dominated by shallow forms of reading, Bionic Reading aims to encourage a more in-depth reading and understanding of written content.';
const bionicText = bionicReading(text);
console.log(bionicText); // '<b>Bion</b>ic ... <b>conte</b>nt.'
CommonJS (NodeJS)
const { bionicReading } = require('bionic-reading');
const text =
'Bionic Reading is a new method facilitating the reading process by guiding the eyes through text with artificial fixation points. As a result, the reader is only focusing on the highlighted initial letters and lets the brain center complete the word. In a digital world dominated by shallow forms of reading, Bionic Reading aims to encourage a more in-depth reading and understanding of written content.';
const bionicText = bionicReading(text);
console.log(bionicText); // '<b>Bion</b>ic ... <b>conte</b>nt.'
📚
API
BionicReading(text: string, options?: Options)
bionicReading('bionic-reading'); // '<b>bionic-</b>reading'
Options
type Options = Partial<{
highlightTag: string;
markdown: boolean;
markdownStyle: string;
}>;
highlightTag
- Default Value:
'b'
// default highlight tag: `<b>`
bionicReading('bionic-reading'); // '<b>bionic-</b>reading'
// changed highlight tag: `<strong>`
bionicReading('bionic-reading', { highlightTag: 'strong' }); // '<strong>bionic-</strong>reading'
markdown
- Default Value:
false
bionicReading('bionic-reading', { markdown: true, highlightTag: 'strong' }); // '**bionic-**reading'
If true, the highlightTag
option is ignored.
markdownStyle
- Default Value:
'**'
bionicReading('bionic-reading', { markdown: true, markdownStyle: '__' }); // '__bionic-__reading'
If the markdown
option is false, this option is ignored.
Motivations
License
MIT @Gumball12