`dir: rtl` isn't written to `<html>` in HTML output

Đang mở Phù hợp với người mới
#1,219 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
78/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
rust
Lĩnh vực
backend

Hướng nghiên cứu

Read crates/quarto-core/src/template.rs, especially the two <html> templates at lines 145 and 259. Render the provided dir: rtl example and inspect the generated <html> tag. Done means both templates include the document direction when set, and the rendered tag contains dir="rtl".

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

This issue was written by Claude while adding q2 support to Great Docs. The output shown comes from running each repro.

Bug description

A document's dir option sets the text direction. Quarto 1 writes it on the root element as
dir="rtl". q2 accepts the option and Lua filters see it in meta.dir, but the HTML templates
don't write it: crates/quarto-core/src/template.rs:145 and :259 are
<html$if(lang)$ lang="$lang$"$endif$>. So Arabic, Hebrew, Persian and Urdu pages render
left-to-right.

Great Docs sets dir: rtl for sites in those languages. Under q2, Great Docs' filter records the
direction in a <meta> tag, and a post-render script adds it to <html>.

Steps to reproduce
mkdir rtl && cd rtl
printf -- '---\ntitle: RTL\nlang: ar\ndir: rtl\n---\n\nمرحبا\n' > index.qmd
q2 render index.qmd
grep -o '<html[^>]*>' index.html
Actual behavior
<html lang="ar">
Expected behavior

As in Quarto 1.9.37:

<html xmlns="http://www.w3.org/1999/xhtml" lang="ar" xml:lang="ar" dir="rtl">

The dir attribute is the part that matters. Adding $if(dir)$ dir="$dir$"$endif$ to both
templates' <html> tags would do it, as in Pandoc's HTML5 template.

Ngôn ngữ chính
Rust
Star
302
Fork
22
Merge trung bình
5 giờ 2 phút
Pull request đã merge (30 ngày)
213

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của quarto-dev/q2

Tất cả issue của quarto-dev/q2

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.