-
Notifications
You must be signed in to change notification settings - Fork 0
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
Do not remove image's styles #32
Conversation
@@ -212,8 +212,7 @@ function overrideLinks(content, node, urlHash, lang, doc) { | |||
|
|||
content = content.replace(REGEXP.SRC, function(str, href){ | |||
//if href is absolute (src="http://..." ) return href | |||
href = /^http/.test(href) ? href : buildSrcForImages(href, doc); | |||
return '<img src="' + href + '"'; | |||
return /^http/.test(href) ? str : '<img src="' + buildSrcForImages(href, doc) + '"'; |
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.
for relative links attrs will still be dropped, isn't it?
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 am agree, looking very strange
@tadatuta @tavriaforever thank u, Update PR |
@@ -155,10 +155,11 @@ function recognizeRelativeLinkForLibraryDocs(str, node) { | |||
* @param {BaseNode} doc node | |||
* @returns {*} | |||
*/ | |||
function buildSrcForImages(href, doc) { | |||
function buildSrcForImages(str, href, doc) { | |||
var docParentUrl = doc && doc.url.replace(/\/\w*\.md/, '/'); // replace last url's part: repo/docs/a.md -> repo/docs |
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.
if there's a change that there's no doc
, src
will be broken
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.
yes, but we have no another way to know whole path to img.
actually |
Before, code from bse-admin remove style for images
<p><img src="https://img-fotki.yandex.ru/get/15483/158800653.1/0_111ff6_bcf15529_orig"></p>
after, we left all of attributes
<p><img style="float: right; padding: 0 0 10px 10px;" title="BEMup в Минске" alt="фотография программы с минского BEMup" src="https://img-fotki.yandex.ru/get/15483/158800653.1/0_111ff6_bcf15529_orig"></p>