PEG Markdown Highlight
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Defines
Public Member Functions | Properties
HGMarkdownHighlighter Class Reference

Highlighter for an NSTextView. More...

#import <HGMarkdownHighlighter.h>

List of all members.

Public Member Functions

(id) - initWithTextView:
 Init new instance while setting targetTextView.
(id) - initWithTextView:waitInterval:
 Init new instance while setting targetTextView and waitInterval.
(id) - initWithTextView:waitInterval:styles:
 Init new instance while setting targetTextView, waitInterval and styles.
(void) - readClearTextStylesFromTextView
 Read and store the representation of "clear" text from the current state of the NSTextView.
(void) - applyStylesFromStylesheet:withErrorDelegate:errorSelector:
 Parse stylesheet and apply the resulting styles.
(void) - parseAndHighlightNow
 Manually invoke parsing and highlighting of the NSTextView contents.
(void) - highlightNow
 Manually invoke highlighting (without parsing) of the NSTextView contents.
(void) - clearHighlighting
 Clear highlighting from the NSTextView.
(void) - activate
 Begin tracking changes in the NSTextView.
(void) - deactivate
 Stop tracking changes in the NSTextView.

Properties

NSArray * styles
 The order and styles for higlighting different elements.
HGMarkdownHighlightingStylecurrentLineStyle
 The style for highlighting the current line.
NSTimeInterval waitInterval
 The delay between editing text and it getting highlighted.
NSTextView * targetTextView
 The NSTextView to highlight.
BOOL parseAndHighlightAutomatically
 Whether to parse and highlight after each change.
BOOL isActive
 Whether this highlighter is active.
BOOL resetTypingAttributes
 Whether to reset typing attributes after highlighting.
BOOL makeLinksClickable
 Whether add hyperlink property to links.
int extensions
 The extensions to use for parsing.

Detailed Description

Highlighter for an NSTextView.

Given a reference to an NSTextView, handles the highlighting of its contents based on the Markdown syntax.


Member Function Documentation

- (void) activate

Begin tracking changes in the NSTextView.

Begin listening for scroll events in the NSTextView's enclosing scroll view and highlighting the visible range upon scrolling. If parseAndHighlightAutomatically is YES, this method will make the highlighter start listening for changes in the target NSTextView's contents.

See also:
- deactivate
- (void) applyStylesFromStylesheet: (NSString *)  stylesheet
withErrorDelegate: (id)  delegate
errorSelector: (SEL)  selector 

Parse stylesheet and apply the resulting styles.

Parameters:
[in]stylesheetThe stylesheet string to parse
[in]delegateDelegate object to handle stylesheet parsing errors
[in]selectorSelector to be invoked on the specified delegate object when errors occur in stylesheet parsing. The argument sent with the message is an NSArray containing error messages (NSStrings).

Clear highlighting from the NSTextView.

This method depends on the values stored by readClearTextStylesFromTextView.

- (void) deactivate

Stop tracking changes in the NSTextView.

See also:
- activate

Read and store the representation of "clear" text from the current state of the NSTextView.

Use this method to tell this highlighter what "clear" formatting should look like. The values stored by this method are used by clearHighlighting.

Note that if you provide the target NSTextView in the init method call, this method will be called automatically at that time.


Property Documentation

- (HGMarkdownHighlightingStyle*) currentLineStyle [read, write, retain]

The style for highlighting the current line.

The value of this property, if set, comes from stylesheets read by calling -applyStylesFromStylesheet:withErrorDelegate:selector:.

See also:
applyStylesFromStylesheet:withErrorDelegate:selector:
- (int) extensions [read, write, assign]

The extensions to use for parsing.

A bitfield of pmh_extensions values.

See also:
pmh_extensions
- (BOOL) isActive [read, write, assign]

Whether this highlighter is active.

See also:
- activate
- deactivate
- (BOOL) makeLinksClickable [read, write, assign]

Whether add hyperlink property to links.

Whether to make all links clickable (i.e. make them behave like hyperlinks).

- (BOOL) parseAndHighlightAutomatically [read, write, assign]

Whether to parse and highlight after each change.

Whether this highlighter will automatically parse and highlight the text whenever it changes, after a certain delay (determined by waitInterval).

See also:
waitInterval
- (BOOL) resetTypingAttributes [read, write, assign]

Whether to reset typing attributes after highlighting.

Whether to reset the typing attributes of the NSTextView to its default styles after each time highlighting is performed.

This feature depends on the values stored by readClearTextStylesFromTextView.

- (NSArray*) styles [read, write, copy]

The order and styles for higlighting different elements.

Values must be instances of HGMarkdownHighlightingStyle. The order of objects in this array determines the highlighting order for element types. You can use the helper macros defined in HGMarkdownHighlightingStyle.h to create the array (see the implementation of the private -getDefaultStyles method in this class for an example).

See also:
HGMarkdownHighlightingStyle
element_type

The documentation for this class was generated from the following file: