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

No longer export md_ns() and instead assign the namespace by default? #48

Open
maelle opened this issue May 25, 2021 · 6 comments
Open

Comments

@maelle
Copy link
Member

maelle commented May 25, 2021

No description provided.

@maelle
Copy link
Member Author

maelle commented May 27, 2021

What's your take @zkamvar?

@zkamvar
Copy link
Member

zkamvar commented May 27, 2021

I remember thinking about this earlier and abandoning the idea initially because I didn't really understand how to do it best (you can see my struggles in https://github.com/carpentries/pegboard/blob/main/.notes/namespaces.Rmd)

But now that I think of it, there is a way of doing this that will prevent the need for both md_ns() AND copy_xml() (maybe), but there are other caveats that we have to deal with. I'm going to write up a short explanation of what I've found and how it impacts {tinkr}, {pegboard}, and any of the other revdeps.

In short, this change will (probably) be a breaking change because the md:node prefix will (potentially) no longer work (but that depends on how we handle the situation).

@zkamvar
Copy link
Member

zkamvar commented May 27, 2021

So, I think the easy solution for us will be the following strategy:

  1. strip the namespace immediately on read
  2. on write, add the namespace back in as a default namespace

The downsides to this are:

  1. all code that used the md:node prefix strategy will need to modify the code
  2. anyone who exports the raw XML will be missing the crucial namespace, so we might want to provide a wrapper to re-add the default namespace (and no, a prefixed namespace will not work)

@maelle
Copy link
Member Author

maelle commented May 28, 2021

all code that used the md:node prefix strategy will need to modify the code

Hopefully that's a breaking change for the best?

anyone who exports the raw XML will be missing the crucial namespace, so we might want to provide a wrapper to re-add the default namespace (and no, a prefixed namespace will not work)

Why would someone export the raw XML? (genuine question)

@maelle
Copy link
Member Author

maelle commented May 28, 2021

Of course this is no longer valid after reading the vignette. 😁

@zkamvar
Copy link
Member

zkamvar commented May 28, 2021

Why would someone export the raw XML? (genuine question)

I mean, {tinkr} does some neat parsing with the rmarkdown chunk attributes and anchor links. People might want to export it into XML so they can work with it in a language they understand better (like JS or Python).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants