Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow mutating line and character rules #96

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/SwiftyMarkdown/CharacterRule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public struct CharacterRule : CustomStringConvertible {
public let primaryTag : CharacterRuleTag
public let tags : [CharacterRuleTag]
public let escapeCharacters : [Character]
public let styles : [Int : CharacterStyling]
public var styles : [Int : CharacterStyling]
public let minTags : Int
public let maxTags : Int
public var metadataLookup : Bool = false
Expand Down
10 changes: 5 additions & 5 deletions Sources/SwiftyMarkdown/SwiftyLineProcessor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ public struct FrontMatterRule {
}

public struct LineRule {
let token : String
let removeFrom : Remove
let type : LineStyling
let shouldTrim : Bool
let changeAppliesTo : ChangeApplication
public let token : String
public let removeFrom : Remove
public var type : LineStyling
public let shouldTrim : Bool
public let changeAppliesTo : ChangeApplication

public init(token : String, type : LineStyling, removeFrom : Remove = .leading, shouldTrim : Bool = true, changeAppliesTo : ChangeApplication = .current ) {
self.token = token
Expand Down
6 changes: 3 additions & 3 deletions Sources/SwiftyMarkdown/SwiftyMarkdown.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ public enum CharacterStyle : CharacterStyling {
}
}

enum MarkdownLineStyle : LineStyling {
var shouldTokeniseLine: Bool {
public enum MarkdownLineStyle : LineStyling {
public var shouldTokeniseLine: Bool {
switch self {
case .codeblock:
return false
Expand Down Expand Up @@ -66,7 +66,7 @@ enum MarkdownLineStyle : LineStyling {
case orderedListIndentSecondOrder
case referencedLink

func styleIfFoundStyleAffectsPreviousLine() -> LineStyling? {
public func styleIfFoundStyleAffectsPreviousLine() -> LineStyling? {
switch self {
case .previousH1:
return MarkdownLineStyle.h1
Expand Down