-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Html to md feature #3099
Html to md feature #3099
Conversation
# Conflicts: # browser/main/modals/NewNoteModal.js # package-lock.json # package.json # yarn.lock
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove the package-lock.json file please? Thank you 👍
reject({result: false, error: 'Please check your URL is in correct format. (Example, https://www.google.com)'}) | ||
} | ||
|
||
const request = url.includes('https') ? https : http |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you replace this with url.startsWith("https")
instead?
@AWolf81 Can you fix the wrong color for dracula theme? Also, it seem that the code doesn't work on tables, can you check again? For example, try this URL and take a look at the table section. |
@ZeroX-DG fixed Dracula theme and added the gfm turndown plugin. Table generation is not working perfectly but I'm not sure how to fix it. Text between two tables is not correctly rendered (see below screenshot). Adding a new line after the first table fixes the rendering. With-out the space it is rendering the three parts in tbodys. With the space the text is a p-tag and the rest are two tables. OK, the issue is not Turndown. It's caused by Please have a look at the following minimal example: Update OK, the above issue with the "p-tag" with-in the table can't be avoided as MultiMd Plugin is handling every new line that contains a So we can't improve that behavior. |
const html = document.createElement('html') | ||
html.innerHTML = data | ||
|
||
const scripts = html.getElementsByTagName('script') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AWolf81 Instead of doing this, can we use the turndown remove rule?
https://github.com/domchristie/turndown#removefilter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ZeroX-DG good idea. I'll change this in one week as I'm without a computer at the moment.
remove
filter should simplify this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ZeroX-DG OK, I've changed the filtering. I've created a basic Codesandbox example to check that the script
tag is not available in Bootstnote.
If you open the URL in the browser it will execute an alert
and in BoostNote there is no script
tag available.
Is there more I can test?
The html
constant can be removed as Turndown is handling the conversion string to md - it was just there for the script filtering.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it looks good now. Thank you for your contribution!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🎉
Found an edgecase where this can crash the new note menu: #3308 |
Description
I'm addressing the requested review from PR #1980. If I've missed anything please let me know. @StormBurpee I've based this on your branch and addressed the review comments - hope that's OK.
I think the feature is working as expected. The only thing that I have noticed is that the image is not copied to the created note.
What do you think can we address that after this PR or should I put some work into it and check it? But I think we would have to discuss this a bit e.g. copy the image as an asset or create a link to the original location. I think copying would be better.
To the test:
Is the test OK? It just checks that the created note is written to disc and that the keys are correct. I think that's OK as we don't have to check that
Turndown
is converting the html to markdown correctly.Or is there anything else to test?
Issue fixed
#923
Type of changes
Checklist:
Screenshots
Link below the other new note options
Import dialog with error text
IssueHunt Summary
Referenced issues
This pull request has been submitted to:
IssueHunt has been backed by the following sponsors. Become a sponsor