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

Markdown or HTML in text fields #6

Open
rwb27 opened this issue Aug 15, 2017 · 4 comments
Open

Markdown or HTML in text fields #6

rwb27 opened this issue Aug 15, 2017 · 4 comments
Assignees
Labels
compatibility Making DocuBricks convertible into other formats enhancement help wanted

Comments

@rwb27
Copy link
Contributor

rwb27 commented Aug 15, 2017

I have lots of feature requests, but this is probably the most important one: it would be fantastic to be able to include formatting (bold, newlines, lists, and hyperlinks) in the text for each step, and the other text fields. This would require a change to the file format so, while I'm happy to update the viewer to make this possible, it would be really great to discuss with Tobey and the team which option is best. I see two viable ways of doing it:

  1. Markdown (or similar), which has some advantages:
  • Easy to write
  • Human-readable in plain text
  • Doesn't confuse the XML parser (still shows up as a string)
    Markdown also has some disadvantages:
  • No longer specified by an XML format (assuming at some point there will be a formal XML spec)
  • Requires some white space preservation, which isn't normal in XML docs
  1. HTML tags in descriptions. The primary advantages are:
  • Unambiguous specification
  • It's valid XML and can be included in the DocuBricks format
    The disadvantage is that it's less human-readable and could open security holes

I would propose that the XML specification is amended to allow a small subset of HTML tags in what are currently multiline text fields (the <description> and <long_description> elements). This can be converted to and from markdown for easy GUI editing (see the bottom example on the react page or to-markdown). A decent working selection of tags would be <b>, <i>, <u>, <em>, <a>, <br>, <ul>, <ol>, <li>, <p> although of course more could be added later. I'm not sure if <p> is a good idea or not - if it's allowed, then it suggests everything should be in a paragraph for consistency...

As a bonus, doing it this way doesn't constrain us to just what markdown allows - for example we could introduce a tag that highlights some text with a little warning icon, as commonly seen in instruction manuals.

As and when I get time, I might make a start on this approach - I am very open to being steered, however, because the last thing I want to do is diverge from the standard!

@rwb27
Copy link
Contributor Author

rwb27 commented Sep 19, 2017

I'm probably going to go for HTML, and might implement this in the next month or two...

@rwb27
Copy link
Contributor Author

rwb27 commented Oct 26, 2017

I've now done this in my fork of the viewer - you can check it out at http://rwb27.github.io/openflexure_microscope/docubricks/current_master_version.html

Currently the descriptions of assembly steps in bricks, and the abstract, note, and long description of bricks are allowed to contain a small selection of safe-looking HTML tags (see the function I added to docubricksviewer.tsx). This should be fairly trivial to extend to other blocks of text.

I have an issue on my fork with more details.

@rwb27 rwb27 mentioned this issue Nov 3, 2017
@MakerTobey
Copy link
Member

This would be super useful also for others users entering a lot of Meta information in a project. We should integrate these capabilities asap.

@MakerTobey MakerTobey added compatibility Making DocuBricks convertible into other formats help wanted labels Apr 19, 2020
@MakerTobey
Copy link
Member

This topic is now high priority. DocuBricks documentations should become portable and editable in other formats and web-platforms.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compatibility Making DocuBricks convertible into other formats enhancement help wanted
Projects
None yet
Development

No branches or pull requests

3 participants