githawkapp / cmark-gfm-swift Goto Github PK
View Code? Open in Web Editor NEWAn extension of GitHub's cmark fork with a Swift AST wrapper.
Home Page: http://githawk.com
License: MIT License
An extension of GitHub's cmark fork with a Swift AST wrapper.
Home Page: http://githawk.com
License: MIT License
According to spec.
There is bracket syntax for links which contain whitespaces.
However, cmark-gfm-swift does not handled it correctly.
input:
[link](</my uri>)
cmark-gfm's output:
<p><a href="/my%20uri">link</a></p>
cmark-gfm-swift's output:
<p>[link](</my uri>)</p>
I was unable to use cmark-gfm-swift without some extra effort. In its current state, if you use normal Carthage methodologies to include this framework (add to Linked Framework and Libraries, post-process using the Copy Carthage Frameworks script) you will get the following error when you try and import the module in a swift file:
cmark.h not found with <angled> include; use ”quotes" instead
A quick fix is to add this to XCode's HEADER_SEARCH_PATHS:
$(SRCROOT)/Carthage/Checkouts/cmark-gfm-swift/**
The correct fix is to modify the modulemap so that cmark.h (and dependencies? unsure) are included in the compiled framework. I believe that the way to do this is to go into the project's Build Phases and edit the Headers section, moving cmark.h from the Private Headers group to the Public Headers group.
This test will fail.
func testMarkdownCheckbox_withChecked_withMultibyte() {
let markdown = """
- [x] テスト
- [x] テスト2
"""
let node = Node(markdown: markdown)!
XCTAssertEqual(node.elements.count, 1)
guard case .list(let items, _)? = node.elements.first else { fatalError() }
// get second checkbox after multibyte characters
guard case .paragraph(let paragraph)? = items[1].first else { fatalError() }
guard case .checkbox(let checked, let range) = paragraph[1] else { fatalError() }
XCTAssertEqual(markdown.substring(with: range), "[x]")
}
The location of the checkbox should be converted into multibyte count here.
I'm not sure the best way to get the whole content of the original markdown, but this might work.
var location = Int(cmark_node_get_checkbox_location(node))
if let string = String(bytes: original_markdown.utf8.prefix(location), encoding:.utf8) {
location = string.count
}
Currently, Info.plist
is under Source
directory and gets added to Compiled Sources
while it'd not needed. In addition, this would cause the new build system which is also the default in Xcode 12 to fails compiling any app using this project as a pod dependency. Following is the error thrown by build system:
error: Multiple commands produce 'path_to_build/Build/Products/Debug-iphonesimulator/cmark-gfm-swift/cmark_gfm_swift.framework/Info.plist':
1) Target 'cmark-gfm-swift' has copy command from 'path_to_project/Pods/cmark-gfm-swift/Source/Info.plist' to 'path_to_build/Build/Products/Debug-iphonesimulator/cmark-gfm-swift/cmark_gfm_swift.framework/Info.plist'
2) Target 'cmark-gfm-swift' has process command with input 'path_to_project/Pods/Target Support Files/cmark-gfm-swift/Info.plist'
Hi, it seems that cmark-gfm supports footnotes and there is already an extension for that.
I think cmark-gfm-swift needs to support it also.
If time allows, I'm going to implement this.
Is it okay to do some PRs? or is there any extension inclusion criteria?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.