Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jccr/tiny-cfi

Generate EPUB CFI steps for a node in 40 lines of code!
https://github.com/jccr/tiny-cfi

cfi dom epub epub3 html

Last synced: about 2 months ago
JSON representation

Generate EPUB CFI steps for a node in 40 lines of code!

Awesome Lists containing this project

README

        

# Tiny CFI

Generate a minimal CFI for a target node, with only the DOM as a dependency.

## Caveats

A bunch. This is very rudimentary.
Only the element steps are generated.
No ranges, no text offsets, no ID assertions.

## Usage

```
generateCfiSteps(target, root)
```

## Example

Given the HTML:

```





Hello world






```

Running `npm i && npm test` should print out `/4/2/6`

Refer to `main.js` as a code example.