-
-
Notifications
You must be signed in to change notification settings - Fork 28
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
Implement Markdown View #820
Comments
Added a markdown view with stubbed out methods, plus a markdown template. This view will retrieve and parse markdown. refs #820
This issue is closely related to issues #589 and issue #726. I will record updates in this issue only from now on. The list of markdown elements that we'd like to support are listed in this Javascript-Markdown-Library-Comparison spreadsheet. To test a markdown to html converter, I created an example XML doc that includes all of these elements. I used this xml doc to test the functionality of Since |
Awesome @robyngit - your fiddle looks like Showdown is really promising. 🤠 |
Added the most recent version (1.9.0) of the markdown to html converter, `showdown`, to the components directory and mapped its alias in `app.js`. Rendered the MarkdownView as a sub view in ProjectView in order to eventually preview the results of the showdown converter. refs #820, DataONEorg/collections-portals-schemas#35
Fantastic, @robyngit. I really like how thorough your test and demo are. So I see that two major features are not in this demo: math and citations. I'm not clear as to why the math support is hard to test here. Can you explain? And how confident are you that showdown will be able to support those, or that we will be able to write a plugin that supports them? Note that the remark.js supports math through a plugin. Thanks for the clarifications. |
@robyngit wrote:
While JSFiddle doesn't provide a CDN-linked copy of the math or citation showdown JS libraries, you can install the library somewhere web-accessible and link directly to it in JSFiddle. Is that the only issue? |
I also noticed that the DocBook tags don't seem to be supported (at least in the fiddle). I would expect the So, we may need to do some pre-processing from DocBook to inline HTML so the markdown processor can then do the rest. I'm not seeing much for DocBook to HTML Javascript libraries out there (server side there is pandoc of course). Since EML only supports a small subset of DocBook tags, writing an XSLT stylesheet that does the conversion would be tractable, and could be applied in the browser as a pre-processing step. |
@csjx @mbjones: As Chris suggested, the main problem was a lack of CDN's. I was also getting a You're right, the |
Ah, yes, a showdown extension for Docbook XML would be great. For the non-CDN hosting, you would need to host the files on a web server that supports cross origin requests (CORS). dev.nceas.ucsb.edu, test.arcticdata.io, etc are set up that way. But like you said, showdown support looks probable, so I don't feel like the fiddle needs to be updated. Doing this work directly in MetacatUI should be fine. |
Great! Then I'll continue moving forward with getting showdown + extensions working in metacatUI. :) |
Added markdown to the example XML that we'll use to test showdown. The new markdown will be used to test showdown's citation, footnote, and math extensions. refs NCEAS/metacatui#820
For reference: The example project XML that includes all the complex markdown is available on dev. knb. Its id is |
…View This is the first step in setting up the markdown view. The next step is using showdown to convert the markdown to HTML. I added a listener to projectView so that the subviews render after the model syncs, since information from the model is required for all the subviews. This causes a delay before the subviews are rendered, so perhaps there is a better way to achieve this. I added all the subviews to the subviews array and used _.invoke to have them all render. refs #815, #820
Got the basic functionality of showdown working in the markdown view. Extensions still need to be added. refs #820
Showdown is now working in MarkdownView! 🎉 Just need to add in the extensions. This can be previewed with all the markdown elements we will support here: Extensions to add:
|
Added the highlight.js components and created a highlight-showdown extension in markdownView relates to #820
Added the katex extension to the showdown converter in MarkdownView so block and inline math is now converted to html. The katex extension config could use a little tweaking. Also relocated the showdown extension components into a single directory. related to #820
Added all of the docbook tags that are allowed in EML relates to: NCEAS/metacatui#820
Added footnotes, bootstrap, and docbook extensions to the markdown view. Added a test that checks the markdown and only adds each extension when required. Extensions are still loaded in the top define function though, need to figure out how to properly load them as required. Also need to include more bootstrap classes in the extension (so far it only adds a class to tables). relates to #820 "showdownKatex", "showdownHighlight", "showdownFootnotes", "showdownBootstrap", "showdownDocbook", "showdownCitation",
For the markdown view, added more scientific languages to highlightJS (used by the showdown converter). Languages included in the package can be viewed in the README in the showdown-highlight component folder. relates to #820
Used require() to load showdown extensions as needed. The showdown converter is triggered once all extensions are tested for a loaded if required. relates to #820
Added a showdown xss filter extension that mitigates the risk of some cross-site scripting attacks. relates to #820
Created an extension that connects showdown to citationjs. The extension is now working in the markdownView. Still needs some tweaking, including formatting of the bibliography. relates to #820
A note: The citation extension retrieves some data from |
Added formatting to the rendered citations, and fixed the bibliography so that there are no duplicate entries and all entries are sorted. relates to #820
This way it will only show up on the home tab instead of all project tabs. #820
…lex markdown example xml. relates to #3; NCEAS/metacatui#820
The new extension replaces all header tags with a header tag one size smaller (e.g. <h1> --> <h2>). This is to prevent top level header tags in markdown views. relates to #820
Started a readme that gives some guidance on how the showdown extension and markdown view work. relates to #820
citations in markdownThe last issue to resolve in the markdown view is getting inline citations and bibliographies to work as we would like. First attempt Initially, I made an extension that searched for and extracted any DOI, WikidataID, or other input, contained within square brackets like so:
The extension then took this ID and used Issues with this solution
New strategy Bibtex style citation information will be stored in the project xml (and thus in the project model). This information will be passed to the citation showdown extension. The extension should search for bibtex keys in square brackets, like so...
...and match them to the citation information contained within the model. It should use this information to create an in-line citation. The literature cited/bibliography will be created in a separate view. Progress
|
I'm gonna close this issue since we have the remaining task detailed in #870. |
The Markdown View will parse markdown contained within the XML associated with each project. This View must be flexible enough to be used as a component in other (non-project) parts of MetacatUI.
This is a subtask of DataONEorg/collections-portals-schemas#35
The text was updated successfully, but these errors were encountered: