Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

footnotes? #33

Open
hgodinho opened this issue Apr 11, 2023 · 5 comments
Open

footnotes? #33

hgodinho opened this issue Apr 11, 2023 · 5 comments
Labels
help wanted Extra attention is needed

Comments

@hgodinho
Copy link
Contributor

Describe the solution you'd like
footnotes would be awesome

@inokawa inokawa added the help wanted Extra attention is needed label Apr 22, 2023
@hgodinho
Copy link
Contributor Author

I was lookintg at the code, and to implement footnotes it will need to refactor the convertNodes function, since mdastToDocx create the document but don't pass a footnote object to parameters as seen here. The convertNodes function could return a object with nodes and footnotes like so:

// definition
const convertNodes = (nodes: mdast.Content[], ctx: Context): DocxContent[] => {
  const results: DocxContent[] = [];
  const footnotes: any[] = []; // should define more precise type
  for (const node of nodes) {
     ...
     logic to push to footnotes  
  }
  return {
     nodes: results,
     footnotes
  }
}

// calling
const { nodes, footnotes } = convertNodes( nodes, ctx );

this way it will be easier to add more functionalities like splitting the documents into more sections, or adding header and footer options in the future.
But this refactor will affect at least 9 points in transformer.ts where convertNodes is called.

I can try a PR if you like.

@inokawa
Copy link
Owner

inokawa commented May 13, 2023

Hi @hgodinho ,
I agree refactoring is needed because this plugin is very depending of API of docx.
Thank you!

@inokawa
Copy link
Owner

inokawa commented May 15, 2023

#35 is published in 0.1.3. Thanks!

@adaboese
Copy link

Does this mean footnotes were added?

@inokawa
Copy link
Owner

inokawa commented Nov 23, 2023

Yes. It was implemeted but still have limitation described in #35 (comment) , and may have some edge case bugs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants