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

Add helper functions for adding/extracting features #28

Open
zkamvar opened this issue Oct 8, 2020 · 3 comments
Open

Add helper functions for adding/extracting features #28

zkamvar opened this issue Oct 8, 2020 · 3 comments
Labels
enhancement ✨ New feature or request help wanted Extra attention is needed

Comments

@zkamvar
Copy link
Member

zkamvar commented Oct 8, 2020

Is it worthwhile to add helper functions for adding or extracting nodes? There is an issue around namespaces, which can be tricky. Things I think could be on the docket to add:

  • code chunks
  • lists
  • tables

The namespace thing is tricky, should your PR actually add a helper function for adding childs (and siblings and parents?)? The arguments would be everything but not the namespace, that tinkr would set. The function would also check the text ends with a newline, if there's text.

I think adding helper functions for these situations would be quite nice. The only thing is that the code block example is one of the simplest situations because you only need the code block and the text that goes inside. It gets more complex with almost any other element.

One avenue we might explore is having a helper function that inserts user markdown as nodes by passing it through commonmark::markdown_xml() and then taking the children of that new document. That's was one of the strategies I found to work with dealing with list elements in {pegboard}

Originally posted by @zkamvar in #24 (comment)

@zkamvar zkamvar added enhancement ✨ New feature or request help wanted Extra attention is needed labels Oct 8, 2020
@zkamvar
Copy link
Member Author

zkamvar commented Oct 9, 2020

Note that this issue ties closely with #27

@zkamvar
Copy link
Member Author

zkamvar commented Oct 19, 2020

After getting lost in namespace weeds a bit, it appears that this feature is definitely needed because there is no way to cleanly add nodes into the default namespace: https://community.rstudio.com/t/adding-nodes-in-xml2-how-to-avoid-duplicate-default-namespaces/84870/2

@maelle
Copy link
Member

maelle commented May 17, 2021

now that one can add Markdown, is this still needed?

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

No branches or pull requests

2 participants