Canapin
(Coin-coin le Canapin)
4 مايو 2023، 8:22م
2
مرحباً @rokejulianlockhart
يمكنني تكرار المشكلة بالفعل، والمعاينة تختلف عن المنشور.
السطر الفارغ أسفل أو أعلى العلامات الخاصة بك يلعب دورًا بسيطًا هنا ولكنه ليس مهمًا. إذا قمت بإزالتها، فسيتم التفافها حول أقرب محتوى تالي وسابق، ولكن ليس المحتوى بأكمله .
لا توجد أسطر فارغة
بالإضافة إلى ذلك، كيف يحدث أن
import QtQuick
import QtQuick.Controls 2.15 as QQC2
import QtQuick.Layouts
import QtPositioning
وإضافة QQC2 قبل Action و Button و ApplicationWindow و Frame لا تعمل، بينما
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import QtPositioning
import QtQuick.Controls 2.15 as QQC2
وإضافة QQC2.Button (وفقًا لـ [qml+pyqt6] Can't get native control appearance - #2 by carl - Help - KDE Discuss ) تعمل؟
سطر جديد

مع ذلك…
اعتقدت أن المشكلة كانت بسبب أن <strike> كان عنصرًا مضمنًا. يمكنني تكرار المشكلة مع علامات أخرى مثل <b> أو <i>، ولكن ليس مع <strong> أو <em>. لذا فهي ليست بسبب كونها عنصرًا على مستوى السطر. يسمح Discourse بتغليف الكتل بعناصر مضمنة، على ما يبدو مع <strong> أو <em>.
<strong>
<strong>
بالإضافة إلى ذلك، كيف يحدث أن
```qml
import QtQuick
import QtQuick.Controls 2.15 as QQC2
import QtQuick.Layouts
import QtPositioning
```
وإضافة `QQC2` قبل `Action` و `Button` و `ApplicationWindow` و `Frame` لا تعمل، بينما
```qml
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import QtPositioning
import QtQuick.Controls 2.15 as QQC2
```
وإضافة `QQC2.Button` (وفقًا لـ https://discuss.kde.org/t/qml-pyqt6-cant-get-native-control-appearance/1240/2?u=rokejulianlockhart) تعمل؟
سطر جديد
</strong>
لا يبدو أن الأمر يتعلق بـ العلامات المصرح بها ، حيث يقبل Discourse كل هذه العلامات (<strike> و <s> و <b> و <strong> و <i> و <em>…).
لا يبدو أنه خطأ من markdown-it أيضًا، حيث لا يمكنني تكرار المشكلة في العرض التوضيحي الخاص بهم .
5 إعجابات
نظرت بسرعة بدافع الفضول. يبدو أنها مشكلة في مكتبة Nokogiri.
مما تستخدمه Discourse هنا:
doc = Nokogiri::HTML5.fragment(sanitized)
add_nofollow = !options[:omit_nofollow] && SiteSetting.add_rel_nofollow_to_user_content
add_rel_attributes_to_user_content(doc, add_nofollow)
strip_hidden_unicode_bidirectional_characters(doc)
sanitize_hotlinked_media(doc)
add_mentions(doc, user_id: opts[:user_id]) if SiteSetting.enable_mentions
scrubber = Loofah::Scrubber.new { |node| node.remove if node.name == "script" }
loofah_fragment = Loofah.fragment(doc.to_html)
loofah_fragment.scrub!(scrubber).to_html
end
def self.strip_hidden_unicode_bidirectional_characters(doc)
return if !DANGEROUS_BIDI_REGEXP.match?(doc.content)
doc
.css("code,pre")
.each do |code_tag|
next if !DANGEROUS_BIDI_REGEXP.match?(code_tag.content)
Loofah.fragment تستخدم محلل HTML4 الخاص بـ Nokogiri.
يمكن إصلاح هذا باستخدام Loofah.html5_fragment طالما أن Nokogiri >= 1.14.0 و Loofah >= 2.21.0. تستخدم Discourse بالفعل Nokogiri::HTML5.fragment؛ سيكون ذلك منطقيًا.
ملاحظة: Loofah 2.21.0 لم يتم إصداره بعد؛ حاليًا في RC1.
11 إعجابًا
sam
(Sam Saffron)
5 مايو 2023، 3:45ص
5
تصحيح أخطاء رائع! شكراً لك
6 إعجابات
sam
(Sam Saffron)
8 مايو 2023، 3:30ص
6
سأقوم بوضع علامة مرجعية على هذا لمدة 30 يومًا، ونأمل أن يكون اللوفة الجديدة قد صدرت حينها ويمكننا ترقيتها ببساطة.
إعجابَين (2)
sam
(Sam Saffron)
12 مايو 2023، 2:36ص
8
لقد جربت للتو إصدار HTML5 من loofah ونواجه مشكلة أمنية على ما يبدو:
main ← loofah
opened 02:35AM - 12 May 23 UTC
https://meta.discourse.org/t/markdown-preview-and-result-differ/263878
The re… sult of this markdown had different results in the composer preview and the post. This is solved by updating Loofah to the latest version and using html5 fragments like our user had reported. While the change was only needed in [cooked_post_processor.rb](https://github.com/discourse/discourse/pull/21500/files#diff-67de7f44aa04f02ceba9770e5d83b4465add3bd4297be871f94a2233cd4831a7), I've updated the other areas of our codebase to also use the html5 fragment.
> <strike>
>
> Additionally, how come
>
> ```qml
> import QtQuick
> import QtQuick.Controls 2.15 as QQC2
> import QtQuick.Layouts
> import QtPositioning
> ```
>
> and prepension of `QQC2` before `Action`, `Button`, `ApplicationWindow`, and `Frame` doesn't work, whereas
>
> ```qml
> import QtQuick
> import QtQuick.Controls
> import QtQuick.Layouts
> import QtPositioning
> import QtQuick.Controls 2.15 as QQC2
> ```
>
> and addition of `QQC2.Button` (per https://discuss.kde.org/t/qml-pyqt6-cant-get-native-control-appearance/1240/2?u=rokejulianlockhart) does?
>
> </strike>
<img width="643" alt="Screenshot 2023-05-11 at 3 15 36 PM" src="https://github.com/discourse/discourse/assets/1555215/e7087502-b0a1-4219-be0b-ad3904cc6a6f">
Related:
- ~~https://github.com/discourse/discourse/pull/21500~~
- https://github.com/discourse/discourse-footnote/pull/62
- https://github.com/discourse/discourse-bbcode/pull/50
1) PrettyText يوفر الأمان لـ img bbcode
فشل/خطأ: expect(cooked).to eq(html)
متوقع: "<p><img src=\"http://aaa.com<script>alert(1);</script>\" alt=\"\" role=\"presentation\"></p>"
حصل: "<p><img src=\"http://aaa.com<script>alert(1);</script>\" alt=\"\" role=\"presentation\"></p>"
(تمت المقارنة باستخدام ==)
# ./spec/lib/pretty_text_spec.rb:2150:in `block (2 levels) in <main>'
# ./spec/rails_helper.rb:358:in `block (2 levels) in <top (required)>'
# /home/sam/.gem/ruby/3.2.1/gems/webmock-3.18.1/lib/webmock/rspec.rb:37:in `block (2 levels) in <top (required)>'
هذا يبدو محفوفًا بالمخاطر جدًا بالنسبة لي… سأقوم بالرفع…
3 إعجابات
nat
(Natalie T)
20 يونيو 2023، 12:43م
9
شكراً جزيلاً على تصحيح الأخطاء! لقد قمنا بإصلاح هذا باستخدام:
main ← loofah
opened 02:35AM - 12 May 23 UTC
https://meta.discourse.org/t/markdown-preview-and-result-differ/263878
The re… sult of this markdown had different results in the composer preview and the post. This is solved by updating Loofah to the latest version and using html5 fragments like our user had reported. While the change was only needed in [cooked_post_processor.rb](https://github.com/discourse/discourse/pull/21500/files#diff-67de7f44aa04f02ceba9770e5d83b4465add3bd4297be871f94a2233cd4831a7), I've updated the other areas of our codebase to also use the html5 fragment.
> <strike>
>
> Additionally, how come
>
> ```qml
> import QtQuick
> import QtQuick.Controls 2.15 as QQC2
> import QtQuick.Layouts
> import QtPositioning
> ```
>
> and prepension of `QQC2` before `Action`, `Button`, `ApplicationWindow`, and `Frame` doesn't work, whereas
>
> ```qml
> import QtQuick
> import QtQuick.Controls
> import QtQuick.Layouts
> import QtPositioning
> import QtQuick.Controls 2.15 as QQC2
> ```
>
> and addition of `QQC2.Button` (per https://discuss.kde.org/t/qml-pyqt6-cant-get-native-control-appearance/1240/2?u=rokejulianlockhart) does?
>
> </strike>
<img width="643" alt="Screenshot 2023-05-11 at 3 15 36 PM" src="https://github.com/discourse/discourse/assets/1555215/e7087502-b0a1-4219-be0b-ad3904cc6a6f">
Related:
- ~~https://github.com/discourse/discourse/pull/21500~~
- https://github.com/discourse/discourse-footnote/pull/62
- https://github.com/discourse/discourse-bbcode/pull/50
كما هو موضح هنا:
~~
بالإضافة إلى ذلك، كيف
import QtQuick
import QtQuick.Controls 2.15 as QQC2
import QtQuick.Layouts
import QtPositioning
وتقديم QQC2 قبل Action و Button و ApplicationWindow و Frame لا يعمل، بينما
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import QtPositioning
import QtQuick.Controls 2.15 as QQC2
وإضافة QQC2.Button (وفقًا لـ [qml+pyqt6] Can't get native control appearance - #2 by carl - Help - KDE Discuss ) يعمل؟
~~
4 إعجابات
nat
(Natalie T)
تم إغلاقه في
22 يونيو 2023، 12:43م
10
تم إغلاق هذا الموضوع تلقائيًا بعد يومين. لم تعد الردود الجديدة مسموح بها.