forked from netcreateorg/netcreate-2018
-
Notifications
You must be signed in to change notification settings - Fork 1
Feature: Re-implement Markdown support and Image Support #91
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NOTING Decision:
|
If performance is an issue, use a `string` attribute field type instead of `markdown` for very large networks.
Fixes bug where ALL dialogs were opening.
…NCEdge views, and NodeTable/EdgeTable views.
@jdanish two fixes:
|
@jdanish Also, you can use emojis now. e.g. try adding |
Looks good!! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds:
Markdown support in Templates
Custom attribute fields usually use a
string
,numeric
,boolean
, oroption
type.We now have a new
markdown
attribute field type. It essentially works the same as astring
field, but in the rendered view, the string text will be parsed as markdown and rendered as HTML. This supports most markdown formatting, including links and images.Only fields that have been set to a
markdown
type will render as markdown. Any attribute fields that are of typestring
will continue to render as a simple string.To Use a Markdown Field
Custom Markdown type attribute fields need to be defined for the project template you're using before you can use them. The easiest way to use a markdown field is to change an existing field from a
string
type to amarkdown
type.Defining Markdown Type Fields
You can either edit the template using the Template Editor UI, or edit the template
*.template.toml
file directly.Edit the Template using the Template Editor UI
notes
type
property, change the type fromstring
tomarkdown
Edit the
*.template.toml
file directly*.template.toml
file for the project you're working on.type = "string"
totype = "markdown"
.The attribute definition looks like this:
Using a Markdown FIeld
The rendered markdown is only visible in "View" mode. In "Edit" mode you only see the raw string. We currently do not support WYSIWYG in the editor.
**bold**
to the field.Insert Image URL Dialog
To make it easier to insert an image, we added a "Insert Image URL" dialog. To use it:
This is an image.
.an
andimage
.
.NOTE that this is just pure markdown, so be careful while editing the raw text. It's easy to screw up the image markdown.
Additional Features/Fixes
NetGraph
-- replaced byNCGraph
Search
-- replaced byNCSearch
NodeSelector
-- replaced byNCNode
Technical Background
Previously, markdown rendering was done via Joshua's implementation of
markdown-react-js
andMarkdownNote.jsx
. Whilemarkdown-react-js
was created by the same authors ofmarkdown-it
, the repo hasn't been touched in 5 years, so we are deprecating it in favor of the more updatedmarkdown-it
.See
markdown-it
for more information.Issues / TO DO
Will address in the future. See Re-implement MarkDown in notes fields #58.markdown
fields do not support WYSIWYG editing. If this is needed, we can consider adding it later.attribute hovers do not show markdown.No need for now._blank
to markdown linksmarkdown-it-emoji
support has not been implemented yet for the new NCNode and NCEdge.