مقتطفات اقتباس

:information_source: Summary Adds Obsidian-style callouts as an alternative for markdown quotes.
:eyeglasses: Preview Theme Creator
:hammer_and_wrench: Repository GitHub - Arkshine/discourse-quote-callouts
:question: Install Guide How to install a theme or theme component
:open_book: New to Discourse Themes? Beginner’s guide to using Discourse Themes

Install this theme component

This theme component adds support for Obsidian-style callouts in Discourse as an alternative for markdown quotes.

Callouts are a great way to highlight content and add notes, warnings, or other special messages to your posts.


Usage

To create a callout, add [!type] to the first line of a quote, where type is the type identifier. The type identifier determines how the callout looks and feels. To see all available types, refer to Supported types.

:information_source: The type identifier is case-insensitive.

> [!tip] 
> **Tip**: Use `code snippets` to enhance readability. They provide clarity and precision.

Custom title

By default, the title of the callout is its type identifier in title case. You can change it by adding text after the type identifier:

> [!question] Custom Label 🤗
> Callouts labels can be customized.

> [!abstract] [date=2032-12-22 timezone="Europe/Paris"]
> They can also contain special inline formatting like dynamic dates.

You can also create title-only callouts:

> [!success] solved.

chrome_z53bS1GCew

Foldable callouts

You can make a callout foldable by adding a plus + or a minus - directly after the type identifier.

  • + expands the callout by default
  • - collapses it instead
> [!todo]- My Todo List
>
> - [x] Write documentation
> - [ ] Add tests
> - [ ] Review code

> [!todo]+ My Expanded Todo List
>
> - [x] Create repository
> - [ ] Setup CI/CD
> - [ ] Deploy to production

The image shows a Todoist project titled "arkshine" with checkboxes for "Create repository," "Setup CI/CD," and "Deploy to production" under "My Expanded Todo List," and options "My Todo List" and "My Expanded Todo List" visible. (Captioned by AI)

Nested callouts

You can nest callouts in multiple levels.

> [!question] Can callouts be nested?
>
> > [!todo] Yes!, they can.
> >
> > > [!example] You can even use multiple layers of nesting.

> [!tip]
> Here's a helpful tip
>
> > [!info]
> > With some additional information
> >
> > > [!example]
> > > And a nested example
>
> Back to the main tip

Supported default types

You can use several callout types and aliases.
Each type comes with a different background color and icon.

:information_source: You can create your callouts or manage the default ones.
See the callouts setting.

:information_source: Any unsupported type defaults to the note type. See Default Fallbacks section for more information.

:information_source: The type identifier is case-insensitive.

Type Description Aliases
note For general notes and information -
abstract For summaries or abstract sections summary, tldr
info For informational content -
todo For task lists or todo items -
tip For tips and important information hint, important
success For success messages check, done
question For questions and FAQs help, faq
warning For warnings caution, attention
failure For failure notices fail, missing
danger For danger or error messages error
bug For bug reports or known issues -
example For examples -
quote For quotes cite


Callout types examples 2

Customization

Icon

You can use either FontAwesome 6 icon or directly provide an SVG element.

SVG element

While the free FontAwesome version provides many choices, you may feel limited sometimes.
You can provide an SVG element <svg>...</svg>.

Example: Lucile icons – It’s a great set with the advantage of choosing the stroke width.

  1. Select an icon
  2. Adjust the Stroke width
  3. Click on Copy SVG
  4. Go to the theme component settings and paste the content



image

Default Fallbacks

You can set default values for when a specified callout type isn’t found with the following settings:

  • callout_fallback_type
  • callout_fallback_icon
  • callout_fallback_color
> [!discourse is fantastic]
> Yes.

Global configuration

You can customize various aspects of the callouts through

  • Background opacity
  • Border properties (width, style, color, radius)
  • Padding
  • Title font properties (size, weight)
  • Space between icon and title

Per-Callout configuration

Each callout type can be customized with:

  • Custom icon
  • Title text
  • Color scheme
  • Border properties

See the Settings section below.

Settings

Setting Description
callouts Define the callouts.
callout_fallback_type The default callout type to use when the specified type is not found.
Default value: note
callout_fallback_icon The default icon to use when the specified type is not found.
Default value: far-pen-to-square
callout_fallback_color The default color to use when the specified type is not found.
Default value: #027aff
callout_background_opacity The global background opacity for the callout (1 to 100).
Default value: 10
callout_border_width The global border width for the callout.
Default value: empty
callout_border_style The global border style for the callout.
Default value: empty
callout_border_color The global border color for the callout.
Default value: empty
callout_border_radius The global border radius for the callout.
Default value: var(--d-border-radius)
callout_padding The global padding for the callout.
Default value: 0.75em 0.75em 0.75em 1.5em
callout_title_font_size The global font size for the callout title.
Default value: inherit
callout_title_font_weight The global font weight for the callout title.
Default value: bold
callout_title_gap The global gap between the callout icon and title.
Default value: 0.5em
callout_icon_sizep The global size for the callout icon.
svg_icons List of FontAwesome 6 icons used in this theme component.

Per-callout setting page:

Setting Description
Type* The type of the callout.
This identifier will be used in the callout syntax: [!type]
Alias The aliases for the callout, separated by |.
Example: cite|quote
Icon The fontawesome icon for the callout.
You might need to add it to svg_icons setting if it’s not available in the default subset.
Alternatively, you can provide an SVG element directly, e.g. <svg>...</svg>
Icon size The size for the callout icon.
Note: Use only valid CSS values, e.g. 1em, 16px, 1.5rem
Title The title for the callout.
If no title is provided in the callout, this setting will be used.
Note: if both are empty, the title will be the callout type.
Color The color for the callout.
This will be used for the background, title, and icon.
Note: Use only hexadecimal color codes, e.g. #027aff
Border width The border width for the callout.
Border style The border style for the callout.
Border color The border color for the callout.
Important: if you’re using CSS functions to produce an alpha value, such as rgba, make sure not to use spaces between the values, e.g., rgba(145,145,145,0.1)
Border radius The border radius for the callout.

* Required setting

Roadmap

Future development plans may include:

  • Autocomplete types on typing

Credits

42 إعجابًا

رائع!\n\nأعتقد أنه يمكن استخدام هذا الغرض:\n\nAdditional Post "Colour" coding

6 إعجابات

يبدو هذا استخدامًا صالحًا!

8 إعجابات

رائع! أنت عظيم

4 إعجابات

هذه إضافة رائعة. أكثر بكثير مما بدا أن المناقشة الأساسية تتضمنه (مع العلم أنني لم أستخدم Obsidian).

إعجابَين (2)

هذا يبدو مذهلاً. هل سيتم تنسيق التنبيهات بشكل صحيح في البريد الإلكتروني أيضًا؟

إعجابَين (2)

عندما أضفت هذه المكونات إلى موقعي، تلقيت رسالة خطأ مفادها:

:warning: قد لا يعمل موقعك لأن سمة / مكون يحتوي على أخطاء.
ناتج عن ‘اقتباسات’. انقر هنا للتحديث أو إعادة التكوين أو التعطيل.

إعجاب واحد (1)

ما هو إصدار Discourse الذي تستخدمه؟

أنا أستخدم Tests-passed (3.5 beta) ويبدو أنه يعمل بشكل جيد.

إذا كنت تستخدم Stable، فقد لا تزال تستخدم الإصدار 3.4 أو ربما إصدارًا أقدم حيث تم طرح الإصدار 3.4 للتو على Stable.

إعجاب واحد (1)

آه، لم أقم بالترقية مؤخرًا بسبب أمور PostgreSQL. سأبلغ عندما أفعل ذلك!

إعجابَين (2)

لست متأكدًا مما إذا كان هذا هو الحال.. ولكن هناك مشتبه به محتمل نظرًا لأن العديد من التغييرات قد تم طرحها فيما يتعلق بكيفية تغير هياكل TC وما إلى ذلك. مثل الانتقال إلى مكونات Glimmer.

إعجاب واحد (1)

للأسف، لا أعتقد ذلك. سيتطلب ذلك إضافة.

ما هو إصدار Discourse الحالي لديك؟

إعجابَين (2)

لقد قمت بالتحديث إلى أحدث إصدار وهو يعمل الآن.

للأسف، فإن الافتقار إلى دعم البريد الإلكتروني يجعل هذا غير قابل للاستخدام في حالتنا. معظم أعضائنا مشتركين في مجموعات وفئات، وبالتالي يقرؤون الرسائل في بريدهم الإلكتروني. يا للأسف!

3 إعجابات

قد أحاول إنشاء إصدار إضافي لاحقًا!

7 إعجابات

هذه إضافة رائعة لـ Discourse! :heart: :heart: :heart:

هذا بالضبط ما نفتقده في جوهر Discourse، على الأقل الأنواع الأربعة الأكثر شيوعًا من التنبيهات مثل المعلومات والخطر والتحذير والنجاح. لقد كنا نستخدم تنسيق الاقتباس + الرموز التعبيرية لفترة من الوقت وبالتأكيد سنجرب هذا :slight_smile:

5 إعجابات

أحب ما قمت به هنا!

6 إعجابات

شكرا جزيلا!

إعجابَين (2)

مرحباً، هناك شيء واحد فقط، يظهر رمز استدعاء الاقتباس في المقتطفات على صفحتي الرئيسية، سيكون من الأفضل لو لم يظهر:

3 إعجابات

@patrickemin هل يمكنك اختبار الإصدار الأخير؟ يجب أن ينظف مقتطف الموضوع الآن.

4 إعجابات

نعم يعمل شكرا لك!

إعجابَين (2)

شكراً لك على مكون السمة، لقد أعجبني كثيراً!

للأسف، اضطررت إلى تعطيله مؤقتاً لأنه كان يسبب مشاكل بصرية في موقعي ورأيت ما يلي في وحدة التحكم التي تمكنت من تتبعها إلى استدعاءاتك callouts.gjs

إعجابَين (2)