Closed Yankie closed 1 year ago
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).
View this failed invocation of the CLA check for more information.
For the most up to date status, view the checks section at the bottom of the pull request.
Probably need to regenerate some of the snapshots which were probably incorrect. I think npm test -- --update
should do that.
Probably need to regenerate some of the snapshots which were probably incorrect. I think
npm test -- --update
should do that.
Moreover, it seems your reduce func in transform at src/hast/index.ts:93
joins all list items in one list later at lines 123-144...
But there should be 2 lists - ul
with 1 nested ul
and ol
with 1 nested ol
... May be you could distinguish them by bullet
value
I'm not sure yet how and where it should be treated - at hast level or later at html, but i've just started :)
Since I'm new to TS, could you please help me with this? Thanx in advance!
...
// get last child Element from element's children
const getLastElementChild = (el: Element): Element => {
return el.children.filter((e) => {e.type === "element"}).at(-1);
};
...
I've got error about Type 'ElementContent' is not assignable to type 'Element':
src/hast/index.ts:106:3 - error TS2322: Type 'ElementContent' is not assignable to type 'Element'.
Type 'Comment' is missing the following properties from type 'Element': tagName, children
106 return el.children.filter((e) => {e.type === "element"}).slice(-1)[0];
Since I'm new to TS, could you please help me with this? Thanx in advance!
... // get last child Element from element's children const getLastElementChild = (el: Element): Element => { return el.children.filter((e) => {e.type === "element"}).at(-1); }; ...
I've got error about Type 'ElementContent' is not assignable to type 'Element':
src/hast/index.ts:106:3 - error TS2322: Type 'ElementContent' is not assignable to type 'Element'. Type 'Comment' is missing the following properties from type 'Element': tagName, children 106 return el.children.filter((e) => {e.type === "element"}).slice(-1)[0];
Nevermind, I've figured it out!
// get last child Element from element's children
const getLastElementChild = (el: Element): Element => {
return el.children.filter((e) => {e.type === "element"}).at(-1) as Element;
};
Tomorrow, will fix case when list levels of current and prev elements diff by 2 and more
Thanks for the work here. Tests pass now but sounds like there is another test case from you last comment?
@jpoehnelt i'm done!
Here is my test document: https://docs.google.com/document/d/10foD4QkNSSK48o5_1IJabwZ3twpKC4ZUTKo0VaSMYFE
@Yankie do you mind sharing your use case for this library. You can email me at jpoehnelt@google.com. Thanks! Looks like 1.0.2 is available on NPM now.
Sure! Thanks!
It seems like GoogleDocs API does not set
glyphType
for unordered lists