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 replace() method for yarn object #41

Open
zkamvar opened this issue May 11, 2021 · 1 comment
Open

Add replace() method for yarn object #41

zkamvar opened this issue May 11, 2021 · 1 comment
Labels
enhancement ✨ New feature or request

Comments

@zkamvar
Copy link
Member

zkamvar commented May 11, 2021

Now I wonder whether we still need to use replacement instead of adding. 🤔

Originally posted by @maelle in #37 (comment)

At the moment, we have an add_md() method for the yarn object because adding nodes to the document was relatively straightforward process of

  1. convert markdown to nodes
  2. strip namespace from nodes
  3. add nodes to document
  4. copy document

We now have demonstrated processes of replacement as of #39, so adding a replace() method should be as straightforward that takes in a node instead of a position like:

img_links <- xml2::xml_find_all(y$body, ".//md:image", ns = y$ns)
# transform image links to RMarkdown code chunks 
y$replace(img_links, img_chunks)
@zkamvar zkamvar added the enhancement ✨ New feature or request label May 11, 2021
@maelle
Copy link
Member

maelle commented May 17, 2021

should this happen before CRAN submission?

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

No branches or pull requests

2 participants