Closed morteza closed 10 years ago
I'm not quite sure I understand what the feature request here is. Are you referring to the stylesheet parser — that the stylesheets should support a "direction" attribute?
Exactly. Something like this:
editor
foreground: 000000
background: ffffff
caret: 000000
direction: rtl
Even though the stylesheet parser does not explicitly expose a "direction" attribute, you can still add support for it in the code that uses the parser. For example, you can add something like this into -[HGMarkdownHighlighter applyStylesFromStylesheet:withErrorDelegate:errorSelector:]
:
if (cur->type == pmh_attr_type_other && strcmp(cur->name, "direction") == 0)
{
NSWritingDirection direction = NSWritingDirectionNatural;
if (strcmp(cur->value->string, "rtl") == 0)
direction = NSWritingDirectionRightToLeft;
else if (strcmp(cur->value->string, "ltr") == 0)
direction = NSWritingDirectionLeftToRight;
[self.targetTextView
setBaseWritingDirection:direction
range:NSMakeRange(0, self.targetTextView.string.length)];
}
Thank you indeed. I'll forward your response to the 'Mou' developer.
NTextView already supports RTL writing direction via:
- (void)setBaseWritingDirection:(NSWritingDirection)writingDirection
CSS supports it via
direction: rtl;
, and you can simply add another attribute name just liketext-align
attribute.direction
is not exactly alignment, and need separate attribute key.It's gonna change how we suffer writing right-to-left in markdown, and make markdown promotable in more languages.
Thanks for the great job.