or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Do you want to remove this version name and description?
Syncing
xxxxxxxxxx
Section 8: Language information and text direction
lang
anddir
attribute)8.1 Specifying the language of content: the
lang
attributeThis attribute specifies the base language of an element's attribute values and text content.
8.1.1 Language codes
The
lang
attribute's value is a language code. Language codes consist of a primary code and a possibly empty series of subcodes:Example:
en
: Englishen-US
: U.S. version of Englishen-cockney
: Cockney version of English8.1.2 Inheritance of language codes
An element inherits language code information according to the following order of precedence (highest to lowest):
lang
attribute set for the element itselflang
attribute set8.1.3 Interpretation of language codes
Example:
<HTML lang="en-US">
en-US
en
8.2 Specifying the direction of text and tables: the
dir
attributeThis attribute specifies the base direction of directionally neutral text in an element's content and attribute values.
Example: to express a Hebrew quotation, it is more intuitive to write
<Q lang="he" dir="rtl">...a Hebrew quotation...</Q>
Example
8.2.0 希伯來語簡介
希伯來語(Hebrew)是古代猶太民族的通行語言,是現時世上最古老的語言之一,在宗教上具有崇高的地位,古時《聖經》和猶太教的典籍都是用希伯來語所寫。今天,以希伯來語為官方語言的國家有以色列。
希伯來語屬於閃米特語族(Semitic languages),文字的書寫方向是從右到左
希伯來語的書寫文字只有輔音(又稱子音,consonants),而沒有元音(又稱母音,vowels)
舉例說,假設你見到一句英語:
You should love your parents with all your heart.
以希伯來語來書寫,首先要脫掉每個詞語的元音變成:
Y shld lv yr prnts wth ll yr hrt.
再從右到左的方向書寫變成:
.trh ry ll htw stnrp ry vl dlhs Y
8.2.1 Introduction to the bidirectional algorithm
Consider the following example text:
The order of characters stored in computer:
The way to display this sentence depends on which language is predominant.
English
Hebrew
8.2.2 Inheritance of text direction information
Bidirectional algorithm requires a base text direction for text blocks. To specify the base direction of a block-level element, set the element's
dir
attribute. The default value of the dir attribute is "ltr" (left-to-right text).When the
dir
attribute is set for a block-level element, it remains in effect for the duration of the element and any nested block-level elementsInline elements, on the other hand, do not inherit the dir attribute.
8.2.3 Setting the direction of embedded text
Bidirectional algorithm automatically reverses embedded character sequences according to their inherent directionality, see 8.2.1.
owever, in general only one level of embedding can be accounted for.
English
Hebrew
English for all sentence, Hebrew for part of sentence: must supply additional information, which we do by delimiting the second embedding explicitly
8.2.4 Overriding the bidirectional algorithm: the BDO element
dir
is mandatory attribute specifies the base direction of the element's text content.Some situations may arise when the bidirectional algorithm results in incorrect presentation. The BDO element allows authors to turn off the bidirectional algorithm for selected fragments of text
Consider a document containing the same text as before:
the above might be formatted, including line breaks, as:
This conflicts with the bidirectional algorithm, because that algorithm would invert 2WERBEH, 4WERBEH, and 6WERBEH a second time, displaying the Hebrew words left-to-right instead of right-to-left.
Solution:
8.2.5 Character references for directionality and joining control
Since ambiguities sometimes arise as to the directionality of certain characters, specification includes characters to enable their proper resolution.
Some directional entities:
8.2.6 The effect of style sheets on bidirectionality
When an inline element that does not have a
dir
attribute is transformed to the style of a block-level element by a style sheet, it inherits thedir
attribute from its closest parent block elementWhen a block element that does not have a
dir
attribute is transformed to the style of an inline element by a style sheet, explicitly adding adir
attribute (assigned the inherited value) to the transformed element.