-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8fa17d9
commit 35964c6
Showing
5 changed files
with
87 additions
and
6 deletions.
There are no files selected for viewing
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
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
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,47 @@ | ||
import UIKit | ||
import MarkdownView | ||
|
||
class RemoteStyleSheetsSampleViewController: UIViewController { | ||
|
||
init() { | ||
super.init(nibName: nil, bundle: nil) | ||
} | ||
|
||
required init?(coder: NSCoder) { | ||
fatalError("init(coder:) has not been implemented") | ||
} | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
view.backgroundColor = .systemBackground | ||
|
||
let md = MarkdownView() | ||
view.addSubview(md) | ||
md.translatesAutoresizingMaskIntoConstraints = false | ||
NSLayoutConstraint.activate([ | ||
md.topAnchor.constraint(equalTo: view.topAnchor), | ||
md.leadingAnchor.constraint(equalTo: view.leadingAnchor), | ||
md.trailingAnchor.constraint(equalTo: view.trailingAnchor), | ||
md.bottomAnchor.constraint(equalTo: view.bottomAnchor) | ||
]) | ||
|
||
let markdown = """ | ||
# Katex | ||
$\\sqrt{3x-1}+(1+x)^2$ | ||
""" | ||
md.load(markdown: markdown, plugins: [js], stylesheets: [stylesheet]) | ||
} | ||
|
||
} | ||
|
||
extension RemoteStyleSheetsSampleViewController { | ||
var js: String { | ||
let url = URL(string: "https://raw.githubusercontent.com/keitaoouchi/markdownview-sample-plugin/master/dist/dst.js")! | ||
return try! String(contentsOf: url) | ||
} | ||
|
||
var stylesheet: URL { | ||
URL(string: "https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css")! | ||
} | ||
} |
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
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