Serialization API
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 30/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- javascript
Línea de trabajo
Empieza por lib/node.js alrededor de las líneas 141-355 y lee test/spec/serialize.js y test/spec/deserialize.js para entender la representación propuesta del AST y la cobertura. Se considera terminado cuando se hayan resuelto los requisitos de la Node API para la serialización, la deserialización, los accessors públicos y los datos personalizados de los nodos, preservando el comportamiento de deep-equality referenciado.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
I am now serializing and deserializing the AST with a 1:1 exact match such that it could be converted to a JSON document and back to an AST tree.
The rationale for this functionality is that I want to pipe an AST document between processes and felt that parsing documents on the way in and rendering on the way out was too much overhead.
The implementation is two static methods Node.serialize() and Node.deserialize(), I would like it if possible to add these methods to the commonmark Node class.
The code is here:
https://github.com/mkdoc/mkast/blob/aa0fa3c5bf4ca45e8c961ad14640543da60ec529/lib/node.js#L141-L355
The test specs serialize and deserialize have 100% coverage on those methods. Notably the deserialize spec ensures a 1:1 correlation with a deep equals comparison.
Note that we don't expose private properties in the serialized object so that iteration can consistently reference firstChild and next regardless of whether it is a full AST node (with parent references) or a detached serialized object.
During this process a few requests regarding public property access have arisen, could I please expose _lastLineBlank and _htmlBlockType with public getters?
Also at times I need to associate custom data with AST nodes and this has been a bit ad-hoc so far, hence the additional properties file etc. that I would like to tuck away in an object that commonmark Node supports, maybe userData or data?
If we can formalize a way to add custom data to nodes then I can update the serialize and deserialize methods to use that and it could be folded in to commonmark Node.
Thanks for all your help and patience - especially with those questions that deserved a RTFM response ;)
- Lenguaje dominante
- JavaScript
- Estrellas
- 1.6k
- Forks
- 234
- Merge medio
- 1 d 27 min
- PR fusionados (30 d)
- 1
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de commonmark/commonmark.js
-
White space handling looks inconsistent between HTML block element vs HTML inline elementPosiblemente ocupada @mamicicekel la tomó hace 12 días. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 35/100
commonmark/commonmark.js#303 · 2 comentarios ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
commonmark/commonmark.js#287 · 1 reacción ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 20/100
commonmark/commonmark.js#275 ·
-
Delegate node walking to othersAbierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
commonmark/commonmark.js#267 · 3 comentarios ·
-
Inconsistent escape of image altAbierto
Dificultad 3/5 1-2 días Aptitud para principiantes 42/100
commonmark/commonmark.js#264 · 1 reacción ·
Todos los issues de commonmark/commonmark.js
Issues similares
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
maproulette/maproulette-frontend#2944 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
NanmiCoder/dsh-agent-teams#255 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
jaegertracing/jaeger-ui#4618 ·
Los mantenedores suelen responder en 1 día
-
area:plugins enhancement platform:vscode
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
anthropics/claude-code#103166 ·
Los mantenedores suelen responder en 1 día