feat: add plugin version to preview
This commit is contained in:
@@ -2,22 +2,17 @@ import Cocoa
|
||||
|
||||
@main
|
||||
class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
|
||||
@IBOutlet var window: NSWindow!
|
||||
|
||||
|
||||
|
||||
func applicationDidFinishLaunching(_ aNotification: Notification) {
|
||||
// Insert code here to initialize your application
|
||||
}
|
||||
|
||||
|
||||
func applicationWillTerminate(_ aNotification: Notification) {
|
||||
// Insert code here to tear down your application
|
||||
}
|
||||
|
||||
|
||||
func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool {
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,10 @@ class PreviewViewController: NSViewController, QLPreviewingController, WKNavigat
|
||||
func preparePreviewOfFile(at url: URL) async throws {
|
||||
let cssUrl = try bundleFile(filename: "markdown", ext: "css")
|
||||
let md = try Document(parsing: url)
|
||||
|
||||
let ver = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as! String
|
||||
let buildVer = Bundle.main.infoDictionary?["CFBundleVersion"] as! String
|
||||
|
||||
self.url = url
|
||||
self.html = """
|
||||
<!DOCTYPE html>
|
||||
@@ -47,6 +51,10 @@ class PreviewViewController: NSViewController, QLPreviewingController, WKNavigat
|
||||
</head>
|
||||
<body class="markdown-body">
|
||||
\(HTMLFormatter.format(md))
|
||||
|
||||
<footer>
|
||||
QLMarkdown v\(ver) (\(buildVer)) (Github: <a href="https://github.com/relikd/QLMarkdown">relikd/QLMarkdown</a>)
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
"""
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
/* manually added: */
|
||||
body{
|
||||
padding: 40px;
|
||||
}
|
||||
body { padding: 20px 40px 10px; }
|
||||
footer { font-size: 0.6em; color: #777; margin: 50px 0 0; text-align: center; }
|
||||
|
||||
/* Copied from https://github.com/sindresorhus/github-markdown-css */
|
||||
/* Copied from https://github.com/sindresorhus/github-markdown-css (2025-12-04) */
|
||||
.markdown-body {
|
||||
--base-size-4: 0.25rem;
|
||||
--base-size-8: 0.5rem;
|
||||
|
||||
Reference in New Issue
Block a user