-
Notifications
You must be signed in to change notification settings - Fork 166
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
Allow footer text to derive from meta.json #707
Comments
HTML might be ok in the short-term to get this going now, but pretty soon we will need to address the security implications of allowing that HTML injection. It might be easiest to not allow it from the beginning, particularly since nextstrain.org already allows rendering of untrusted inputs via community URLs. We might address the security issues by filtering to a minimal allowed set of tags or by switching to some other, more restricted format which we render to safe HTML. |
Ah! Good point @tsibley. Would markdown be a safe alternative? |
Yes, if whatever we use to render Markdown → HTML has the appropriate restrictions, since most Markdown parsers allow inlining raw HTML and some allow arbitrary element attributes. |
Currently the auspice server (and nextstrain.org server) include a node markdown library which is used to parse the narrative markdown files, sending (sanitized) HTML to the client to render. With the proposed server API, the parsing of the footer markdown (and also the narratives) would need to happen on the client. |
I think best to leave this until after v2 release. We can add in a footer field in the v2 JSONs at a later date and maintain backwards compatibility. |
Update: This "feature" is really important as we (and others) start to integrate auspice into other projects. The dataset JSON should be able to define this. In parallel, this should be made part of the augur auspice-export JSON, and the footers currently defined in auspice moved into their respective augur builds. Note that a few footers contain "links" which dispatch redux actions (e.g. https://github.com/nextstrain/auspice/blob/master/src/components/framework/footer.js#L179). This functionality can be achieved by specifying it as a link to the same dataset with the view parameters encoded in the URL. Not quite as smooth, but good enough in my opinion. |
@jameshadfield I'm slightly unclear on when the footer text is added to Are we going to provide the option within Also, some of the hardcoded text is quite long and makes me question if we want to have it within |
My preference would be to publish a Markdown file alongside the JSONs as another sidecar file (e.g. I think any new option to |
I can understand the simplicity of creating a separate markdown file which auspice fetches (akin to how the current tip-frequencies JSON is currently fetched, and how the root-sequence will be fetched). I'm happy to have it done this way. Also, a note regarding |
Yep, I know, I was just using meta.json as a lingering shorthand. :-) |
Even if we use a separate markdown file for the footer text, the dataset JSON should probably still have a |
We've discussed this previously in a similar context, namely when should auspice fetch a certain sidecar JSON. The decision we made was that, in general, this should not be encoded in the dataset JSON but that auspice should always make the requests and be OK with them |
Yes. I think it makes sense to have a separate "sidecar" file If this So, my suggestion is actually to add a
I agree with this solution. |
I realize now that packaging with 'augur export' will be pretty necessary. For cases like seasonal flu we have 32 datasets produced that share the same footer md. In this scenario, we'd have the same config/footer.md that is passed to 'augur export' for each of the 32 datasets. It's a little weird to have 32 copies of the same file with different names pushed up to S3, but other solutions (like specifying file path in dataset.json) add significant complexity. |
While it's perhaps a little weird to have 32 copies of the file for the flu builds, I think this might be a bit of an outlier scenario? |
I agree with @emmahodcroft, and while 32 copies of the file is a little weird maybe, it doesn't pose any material problems.
I don't want to bikeshed this, so will give my 2¢ here and then shut up: "Acknowledgements" is more specific and descriptive than "footer" and is a term everyone will recognize. "Footer" is tied to page layout and is less communicative about what's intended to go in there. It raises questions like "Which footer is it?" (there are several ostensible footers in Auspice) and "What happens to the filename if Auspice starts putting acknowledgments elsewhere on the page?" (which it already does in the "Download data" modal). Verbosity is not a great reason for choosing a less precise term. |
This makes complete sense @tsibley. I see the rationale for choosing a semantically meaningful term over a layout based term. However, I would suggest in this case something more like |
Sure, I think |
After looking more at the charon API, using a markdown file might be more trouble than it's worth. Everything expects/returns JSON, so there would have to be conditionals littered throughout the API structure to ensure that the correct content type is returned. |
I'll let @jameshadfield / @tsibley speak to the technical working of charon. On the user side, I would be fully okay with having |
Yep, that's what @joverlee521 and I chatted about a few minutes ago, with the difference of putting the Markdown string into the main JSON directly instead of putting it a sidecar. Since it's going into JSON now, there seems little reason to keep it a sidecar. |
To be clear on this though, the HTML produced by the rendering of the Markdown still needs to be sanitized. |
I was going to suggest going with a single file but I was worried about |
Ah, that minification only affects the JSON structure itself, not any values in the JSON, which are always serialized as-is. |
Two questions:
|
|
|
|
I had this same issue on bedford.io. I'll look up what I did. |
|
In case it's helpful. Here's what I did for bedford.io, where I wanted Markdown image links in blog posts to be properly centered. See for example images here: https://bedford.io/blog/avian-influenza-h7n9/, specified in this Markdown: https://raw.githubusercontent.com/blab/blotter/master/blog/_posts/2017-03-10-avian-influenza-h7n9.md The entire post Then I'd think it to be most common to want a single logo-type image centered in the footer, and I might default to centering (which could then be overridden by HTML within the Markdown post itself). |
Defaulting to centering of images for the dataset description/footer makes sense to me. If we use flexbox, it could even work for multiple images (like seasonal flu is already doing), as long as the |
Currently text in footer (https://github.com/nextstrain/auspice/blob/master/src/components/framework/footer.js#L49) is the only remaining place where auspice source code has to get modified in a dataset specific manner. Notably, this currently causes issues with community builds, where for example Paul's work here: https://nextstrain.org/community/pauloluniyi/lassa/s, gets a footer borrowed from here: https://nextstrain.org/lassa/s, which is inaccurate and doesn't appropriately highlight Paul's work.
I recommend adding a
footer
field tometa.json
that auspice uses to specify this text. Probably best to have this be HTML and so people can embed links. Iffooter
is present auspice uses this. If not auspice falls back on current strategy ofwindow.location.pathname.includes
.The text was updated successfully, but these errors were encountered: