contentlayerdev / contentlayerdev/contentlayer

Feature request: parsing custom content formats

Aperta
#128 2 commenti 2 reazioni 0 assegnatari Vedi su GitHub
meta: never-stale
Lingua principale
TypeScript
Stelle
3.5k
Fork
192
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Here's a little wild idea which might be within the scope of contentlayer, or not. I was just wondering whether it would be possible to expose certain utilities that would enable users to define their own `defineDocumentType` or `makeSource` pipeline for custom content types.

This would allow users to parse arbitrary content files that might not currently be supported by contentlayer. Some examples:

- markdown derivatives like [rmd](https://rmarkdown.rstudio.com/articles_intro.html), [quarto](https://quarto.org/)
- json derivatives like [juypter notebook](https://nbformat.readthedocs.io/en/latest/)
- protobuf files
- docx, pdf?

For the first 2 types, I think we are currently one step away from including them in the pipeline. We could run a separate program that converts these files to markdown before passing them to the default markdown pipeline e.g. jupyter users could run `jupyter nbconvert --to markdown notebook.ipynb`

Protobuf files are interesting in that they come with their own proto types so the descriptive field properties would mostly be for parsing particular fields of interest.

For arbitrary file types, I guess it would be more convenient to expose certain methods for the user to implement such that it can be defined as a new type and automatically parsed by contentlayer as part of the process.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Start by reading the defineDocumentType and makeSource entry points referenced in the issue, then trace how the current markdown pipeline accepts content. Done would mean a documented, usable way for users to define and parse custom content formats, with the supported conversion examples clarified.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
jupyter-notebook, typescript
Ambito
content
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.