-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for markdown rendering (#144)
* Write a markdown parser * Hide the markdown rendering behind a feature flag * Apply the markdown rendering on the paragraph element * Support nested emphasis * Seperate the lexing and the parsing * Add a performance test * Move the rendering upwards to the markdown class * Clean up a bit * Remove the statement from the paragraph again As a precaution, until I figure out where to go from here. * Throw an error due to missing activation * Revert last commit * Apply auto escaping to markdown string
- Loading branch information
1 parent
bad6dbe
commit cb34198
Showing
13 changed files
with
1,211 additions
and
1 deletion.
There are no files selected for viewing
114 changes: 114 additions & 0 deletions
114
Sources/HTMLKit/Framework/Rendering/Markdown/Extensions/Markdown+Character.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
import Foundation | ||
|
||
extension Character { | ||
|
||
/// A boolean value indicating whether this character represents an asterisk (U+002A). | ||
internal var isAsterisk: Bool { | ||
|
||
if self == "\u{002A}" { | ||
return true | ||
} | ||
|
||
return false | ||
} | ||
|
||
/// A boolean value indicating whether this character represents a comma (U+005F). | ||
internal var isUnderscore: Bool { | ||
|
||
if self == "\u{005F}" { | ||
return true | ||
} | ||
|
||
return false | ||
} | ||
|
||
/// A boolean value indicating whether this character represents a tilde (U+007E). | ||
internal var isTilde: Bool { | ||
|
||
if self == "\u{007E}" { | ||
return true | ||
} | ||
|
||
return false | ||
} | ||
|
||
/// A boolean value indicating whether this character represents a back tick (U+0060). | ||
public var isBackTick: Bool { | ||
|
||
if self == "\u{0060}" { | ||
return true | ||
} | ||
|
||
return false | ||
} | ||
|
||
/// A boolean value indicating whether this character represents a left square bracket (U+005B). | ||
public var isLeftSquareBracket: Bool { | ||
|
||
if self == "\u{005B}" { | ||
return true | ||
} | ||
|
||
return false | ||
} | ||
|
||
/// A boolean value indicating whether this character represents a right square bracket (U+005D). | ||
public var isRightSquareBracket: Bool { | ||
|
||
if self == "\u{005D}" { | ||
return true | ||
} | ||
|
||
return false | ||
} | ||
|
||
/// A boolean value indicating whether this character represents a left parenthesis (U+0028). | ||
public var isLeftParenthesis: Bool { | ||
|
||
if self == "\u{0028}" { | ||
return true | ||
} | ||
|
||
return false | ||
} | ||
|
||
/// A boolean value indicating whether this character represents a right parenthesis (U+0029). | ||
public var isRightParenthesis: Bool { | ||
|
||
if self == "\u{0029}" { | ||
return true | ||
} | ||
|
||
return false | ||
} | ||
|
||
/// A boolean value indicating whether this character represents a solidus (U+002F). | ||
public var isSolidus: Bool { | ||
|
||
if self == "\u{002F}" { | ||
return true | ||
} | ||
|
||
return false | ||
} | ||
|
||
/// A boolean value indicating whether this character represents a colon (U+003A). | ||
public var isColon: Bool { | ||
|
||
if self == "\u{003A}" { | ||
return true | ||
} | ||
|
||
return false | ||
} | ||
|
||
/// A boolean value indicating whether this character represents a period (U+002E). | ||
public var isPeriod: Bool { | ||
|
||
if self == "\u{002E}" { | ||
return true | ||
} | ||
|
||
return false | ||
} | ||
} |
Oops, something went wrong.