Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Consider a JSONRenderer

Aperta
#131 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
32/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
javascript
Ambito
frontend

Direzione di ricerca

Inizia leggendo l’HTML renderer esistente e confrontando il suo output con la struttura JSONRenderer richiesta. Esamina la specifica vdom collegata e l’esempio CommonMark fornito per definire come devono essere rappresentati tag, attributi, testo ed elementi figli annidati. Il lavoro è completato quando il renderer produce la struttura richiesta per un input equivalente.

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

Descrizione

I'd love to see a "JSONRenderer" which would be equivalent to the HTML renderer's output, except in a form like this:

{
  tagName: "h1",
  children: "whatever",
  attributes: {} 
}

Effectively, what I'm hoping for is something that would match (or be similar to) the vdom type currently being implemented in Jupyter frontends.

Example input:

## Try CommonMark

You can try CommonMark here.  This dingus is powered by
[commonmark.js](https://github.com/jgm/commonmark.js), the
JavaScript reference implementation.

1. item one
2. item two
   - sublist
   - sublist

Example output (click to expand me):
{
  "attributes": {
    "attributes": {},
    "children": [
      {
        "attributes": {},
        "children": "Try CommonMark",
        "tagName": "h2"
      },
      {
        "attributes": {},
        "children": [
          "You can try CommonMark here.  This dingus is powered by",
          {
            "attributes": { "href": "https://github.com/jgm/commonmark.js" },
            "children": "commonmark.js",
            "tagName": "a"
          },
          ", the\nJavaScript reference implementation."
        ],
        "tagName": "p"
      },
      {
        "attributes": {},
        "children": [
          { "attributes": {}, "children": "item one", "tagName": "li" },
          { "attributes": {}, "children": "item two", "tagName": "li" },
          {
            "attributes": {},
            "children": [
              {
                "attributes": {},
                "children": "sublist",
                "tagName": "li"
              },
              { "attributes": {}, "children": "sublist", "tagName": "li" }
            ],
            "tagName": "ul"
          }
        ],
        "tagName": "ol"
      }
    ]
  },
  "children": [
    {
      "attributes": {},
      "children": "Try CommonMark",
      "tagName": "h2"
    },
    {
      "attributes": {},
      "children": [
        "You can try CommonMark here.  This dingus is powered by",
        {
          "attributes": { "href": "https://github.com/jgm/commonmark.js" },
          "children": "commonmark.js",
          "tagName": "a"
        },
        ", the\nJavaScript reference implementation."
      ],
      "tagName": "p"
    },
    {
      "attributes": {},
      "children": [
        { "attributes": {}, "children": "item one", "tagName": "li" },
        { "attributes": {}, "children": "item two", "tagName": "li" },
        {
          "attributes": {},
          "children": [
            { "attributes": {}, "children": "sublist", "tagName": "li" },
            { "attributes": {}, "children": "sublist", "tagName": "li" }
          ],
          "tagName": "ul"
        }
      ],
      "tagName": "ol"
    }
  ],
  "tagName": "div"
}

Lingua principale
JavaScript
Stelle
1.6k
Fork
234
Merge medio
1g 27m
PR unite (30g)
1

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di commonmark/commonmark.js

Tutte le issue di commonmark/commonmark.js

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.