Some new hook to manipulate the HTML at the token level before the parser merges the output into one string
I maintainer di solito rispondono entro 4 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 22/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- typescript
- Ambito
- compilers
Direzione di ricerca
Read the parser in src/Parser.ts to see where each token's rendered HTML is produced and joined, then the renderer and the walkTokens hook in src/Instance.ts and src/Renderer.ts to understand what is reachable today. Check test/ for parser and extension tests, and the extension docs for existing hooks. Done here means an agreed hook design, not a patch: a place where a token and its partial HTML are still both in scope.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What pain point are you perceiving?.
I would like to create an extension that injects HTML properties into the HTML tag of every block-level token. I.e.:
<p customInjectedProperty="someValueFromTheToken">content</p>
Specifically, in this instance I would like to inject the line number from marked-token-position to support Markdown/HTML position syncing.
However the parser does not provide a good opportunity to do so before everything is joined into the final output string. Overriding the renderer for every token can solve this, but can't support tokens from third-party extensions without maintaining a custom list.
I can kind of get away with using walkTokens to just replace the original token.type with some custom token.type = "injectHTMLProp", so it can be caught univerally by the renderer of a custom extension named "injectHTMLProp", where I parse each token and inject properties into the output string while I have access to the token properties, though this feels ugly and makes it hard for other extensions that may also want to similarly manipulate the local HTML before the final string merge.
Describe the solution you'd like
Ideally, it would be nice if the parser somehow maintained a map of token: outputHTML before the final string merge, where a hook could still slip in and manipulate the HTML while we still have access to the accompanying token properties.
- Lingua principale
- TypeScript
- Stelle
- 37.3k
- Fork
- 3.9k
- Merge medio
- 5g 6h
- PR unite (30g)
- 62
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di markedjs/marked
-
Inline raw HTML is escaped after an unclosed `_` / `*` / `~` (regression in 18.2.1)Forse già presa @O1sumitkumar l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 4 giorni
-
Lazy continuation line inside a quoted list item is parsed as a nested listForse già presa @amstedy l’ha presa 1 giorno fa. ApertaL2 - annoying
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
markedjs/marked#4293 · 2 commenti ·
I maintainer di solito rispondono entro 4 giorni
-
Deeply nested emphasis is quadratic and overflows the stack in the lexerForse già presa @Pastalikek65 l’ha presa 5 giorni fa. Apertacategory: inline elements L2 - annoying
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
markedjs/marked#4286 · 1 commento ·
I maintainer di solito rispondono entro 4 giorni
-
Quadratic time in the inline `text` rule: its email look-ahead rereads the rest of the paragraphForse già presa @yxshee l’ha presa 10 giorni fa. ApertaL2 - annoying
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
I maintainer di solito rispondono entro 4 giorni
-
List item ends at a lazy line after a paragraph line indented 4+ columnsForse già presa @hakarrr l’ha presa 14 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
I maintainer di solito rispondono entro 4 giorni
Tutte le issue di markedjs/marked
Issue simili
-
[Bug]: A Markdown link with both a :line suffix and a #L fragment opens a path containing ":line"Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
status:needs-triage type:bug workstream:refimpl
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
GenAI-Security-Project/agent-control-standard#764 ·
I maintainer di solito rispondono entro 1 giorno
-
good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
TanbirRamim/vibereel#39 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
lingdojo/kana-dojo#34988 · 1 commento · 5 reazioni ·
I maintainer di solito rispondono entro 1 giorno