phlex-markdown 0.0.1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.editorconfig +13 -0
- data/.rubocop.yml +15 -0
- data/Gemfile +6 -4
- data/README.md +7 -36
- data/SECURITY.md +5 -0
- data/lib/phlex/markdown/version.rb +7 -0
- data/lib/phlex/markdown.rb +80 -0
- data/sig/phlex.rbs +4 -0
- metadata +46 -18
- data/.gitignore +0 -8
- data/CHANGELOG.md +0 -5
- data/Rakefile +0 -12
- data/bin/console +0 -15
- data/bin/setup +0 -8
- data/blank.gemspec +0 -35
- data/lib/blank/version.rb +0 -5
- data/lib/blank.rb +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9decdb08e89ad1d8deb79e6782b7961102150af4e6e20e0dff67a4ea7ff6c6d7
|
4
|
+
data.tar.gz: 50e51626d52911b3ddb2f31404ede909bdea835b230dff35ed9d4592d6ea1cc9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a09c726ac8e02922efd62342038ebe87abdb107c1729881d0998665d5a6b7147f41294140c6e26b5342a6c56c1b4cca4c9aaf1f399480a0d95caf947d12036da
|
7
|
+
data.tar.gz: 1736bc45133d4336846c8accb29128e27ae9499550ebad59287624a99c2cd09d33b268c95999d670f22300f518e46788c4a8da6cd7a583066c14ccb7d6dcc84f
|
data/.editorconfig
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
inherit_from:
|
2
|
+
- "https://www.goodcop.style/rubocop.yml"
|
3
|
+
- "https://www.goodcop.style/tabs.yml"
|
4
|
+
|
5
|
+
AllCops:
|
6
|
+
TargetRubyVersion: 2.7
|
7
|
+
|
8
|
+
Style/PercentLiteralDelimiters:
|
9
|
+
Enabled: false
|
10
|
+
|
11
|
+
Layout/CaseIndentation:
|
12
|
+
Enabled: false
|
13
|
+
|
14
|
+
Style/StringConcatenation:
|
15
|
+
Enabled: false
|
data/Gemfile
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
source "https://rubygems.org"
|
4
|
+
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
4
5
|
|
5
|
-
# Specify your gem's dependencies in blank.gemspec
|
6
6
|
gemspec
|
7
7
|
|
8
|
-
gem "
|
9
|
-
|
10
|
-
gem "
|
8
|
+
gem "capybara"
|
9
|
+
gem "rubocop"
|
10
|
+
gem "solargraph"
|
11
|
+
gem "sus"
|
12
|
+
gem "syntax_suggest"
|
data/README.md
CHANGED
@@ -1,43 +1,14 @@
|
|
1
|
-
#
|
1
|
+
# `phlex-markdown`
|
2
2
|
|
3
|
-
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/blank`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
3
|
|
5
|
-
|
4
|
+
### Community 🙌
|
6
5
|
|
7
|
-
|
6
|
+
Everyone interacting in Phlex codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/joeldrapper/phlex/blob/main/CODE_OF_CONDUCT.md).
|
8
7
|
|
9
|
-
|
8
|
+
### Sponsorship 💖
|
10
9
|
|
11
|
-
|
12
|
-
gem 'blank'
|
13
|
-
```
|
10
|
+
Maintaining a library is a lot of work. If your company benefits from this work or is likely to benefit from it in the future, please consider [sponsorship](https://github.com/sponsors/joeldrapper). Phlex is actively developed and maintained by **[Joel Drapper](https://github.com/sponsors/joeldrapper)**.
|
14
11
|
|
15
|
-
|
12
|
+
### Security 🚨
|
16
13
|
|
17
|
-
|
18
|
-
|
19
|
-
Or install it yourself as:
|
20
|
-
|
21
|
-
$ gem install blank
|
22
|
-
|
23
|
-
## Usage
|
24
|
-
|
25
|
-
TODO: Write usage instructions here
|
26
|
-
|
27
|
-
## Development
|
28
|
-
|
29
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
-
|
31
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
-
|
33
|
-
## Contributing
|
34
|
-
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/blank. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/blank/blob/master/CODE_OF_CONDUCT.md).
|
36
|
-
|
37
|
-
## License
|
38
|
-
|
39
|
-
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
40
|
-
|
41
|
-
## Code of Conduct
|
42
|
-
|
43
|
-
Everyone interacting in the Blank project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/blank/blob/master/CODE_OF_CONDUCT.md).
|
14
|
+
If you’ve found a potential security issue, please email [security@phlex.fun](mailto:security@phlex.fun).
|
data/SECURITY.md
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "markly"
|
4
|
+
|
5
|
+
module Phlex
|
6
|
+
class Markdown < Phlex::HTML
|
7
|
+
def initialize(content)
|
8
|
+
@content = content
|
9
|
+
end
|
10
|
+
|
11
|
+
def template
|
12
|
+
visit(doc)
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def doc
|
18
|
+
Markly.parse(@content)
|
19
|
+
end
|
20
|
+
|
21
|
+
def visit(node)
|
22
|
+
return if node.nil?
|
23
|
+
|
24
|
+
case node.type
|
25
|
+
in :document | :softbreak
|
26
|
+
visit_children(node)
|
27
|
+
in :text
|
28
|
+
text(node.string_content)
|
29
|
+
in :header
|
30
|
+
case node.header_level
|
31
|
+
in 1 then h1 { visit_children(node) }
|
32
|
+
in 2 then h2 { visit_children(node) }
|
33
|
+
in 3 then h3 { visit_children(node) }
|
34
|
+
in 4 then h4 { visit_children(node) }
|
35
|
+
in 5 then h5 { visit_children(node) }
|
36
|
+
in 6 then h6 { visit_children(node) }
|
37
|
+
end
|
38
|
+
in :paragraph
|
39
|
+
grandparent = node.parent&.parent
|
40
|
+
|
41
|
+
if grandparent&.type == :list && grandparent&.list_tight
|
42
|
+
visit_children(node)
|
43
|
+
else
|
44
|
+
p { visit_children(node) }
|
45
|
+
end
|
46
|
+
in :link
|
47
|
+
a(href: node.url) { visit_children(node) }
|
48
|
+
in :emph
|
49
|
+
em { visit_children(node) }
|
50
|
+
in :strong
|
51
|
+
strong { visit_children(node) }
|
52
|
+
in :list
|
53
|
+
case node.list_type
|
54
|
+
in :ordered_list then ol { visit_children(node) }
|
55
|
+
in :bullet_list then ul { visit_children(node) }
|
56
|
+
end
|
57
|
+
in :list_item
|
58
|
+
li { visit_children(node) }
|
59
|
+
in :code
|
60
|
+
whitespace { code { text(node.string_content) } }
|
61
|
+
in :code_block
|
62
|
+
code_block(node.string_content, language: node.fence_info) do |**attributes|
|
63
|
+
pre(**attributes) { text(node.string_content) }
|
64
|
+
end
|
65
|
+
in :hrule
|
66
|
+
hr
|
67
|
+
in :blockquote
|
68
|
+
blockquote { visit_children(node) }
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def code_block(code, language:)
|
73
|
+
yield
|
74
|
+
end
|
75
|
+
|
76
|
+
def visit_children(node)
|
77
|
+
node.each { |c| visit(c) }
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
data/sig/phlex.rbs
ADDED
metadata
CHANGED
@@ -1,41 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phlex-markdown
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joel Drapper
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-11-
|
12
|
-
dependencies:
|
13
|
-
|
11
|
+
date: 2022-11-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: markly
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: phlex
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: A Markdown view for Phlex
|
14
42
|
email:
|
15
43
|
- joel@drapper.me
|
16
44
|
executables: []
|
17
45
|
extensions: []
|
18
46
|
extra_rdoc_files: []
|
19
47
|
files:
|
20
|
-
- ".
|
21
|
-
-
|
48
|
+
- ".editorconfig"
|
49
|
+
- ".rubocop.yml"
|
22
50
|
- CODE_OF_CONDUCT.md
|
23
51
|
- Gemfile
|
24
52
|
- LICENSE.txt
|
25
53
|
- README.md
|
26
|
-
-
|
27
|
-
-
|
28
|
-
-
|
29
|
-
-
|
30
|
-
|
31
|
-
- lib/blank/version.rb
|
32
|
-
homepage: https://phlex.fun
|
54
|
+
- SECURITY.md
|
55
|
+
- lib/phlex/markdown.rb
|
56
|
+
- lib/phlex/markdown/version.rb
|
57
|
+
- sig/phlex.rbs
|
58
|
+
homepage: https://github.com/joeldrapper/phlex-markdown
|
33
59
|
licenses:
|
34
60
|
- MIT
|
35
61
|
metadata:
|
36
|
-
homepage_uri: https://phlex
|
37
|
-
source_code_uri: https://github.com/joeldrapper/phlex
|
38
|
-
changelog_uri: https://github.com/joeldrapper/phlex
|
62
|
+
homepage_uri: https://github.com/joeldrapper/phlex-markdown
|
63
|
+
source_code_uri: https://github.com/joeldrapper/phlex-markdown
|
64
|
+
changelog_uri: https://github.com/joeldrapper/phlex-markdown/releases
|
65
|
+
funding_uri: https://github.com/sponsors/joeldrapper
|
66
|
+
rubygems_mfa_required: 'true'
|
39
67
|
post_install_message:
|
40
68
|
rdoc_options: []
|
41
69
|
require_paths:
|
@@ -44,7 +72,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
44
72
|
requirements:
|
45
73
|
- - ">="
|
46
74
|
- !ruby/object:Gem::Version
|
47
|
-
version: 2.
|
75
|
+
version: '2.7'
|
48
76
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
49
77
|
requirements:
|
50
78
|
- - ">="
|
@@ -54,5 +82,5 @@ requirements: []
|
|
54
82
|
rubygems_version: 3.3.25
|
55
83
|
signing_key:
|
56
84
|
specification_version: 4
|
57
|
-
summary:
|
85
|
+
summary: A Markdown view for Phlex
|
58
86
|
test_files: []
|
data/.gitignore
DELETED
data/CHANGELOG.md
DELETED
data/Rakefile
DELETED
data/bin/console
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require "bundler/setup"
|
5
|
-
require "blank"
|
6
|
-
|
7
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
-
# with your gem easier. You can also use a different console, if you like.
|
9
|
-
|
10
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
-
# require "pry"
|
12
|
-
# Pry.start
|
13
|
-
|
14
|
-
require "irb"
|
15
|
-
IRB.start(__FILE__)
|
data/bin/setup
DELETED
data/blank.gemspec
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative "lib/blank/version"
|
4
|
-
|
5
|
-
Gem::Specification.new do |spec|
|
6
|
-
spec.name = "phlex-markdown"
|
7
|
-
spec.version = "0.0.1"
|
8
|
-
spec.authors = ["Joel Drapper"]
|
9
|
-
spec.email = ["joel@drapper.me"]
|
10
|
-
|
11
|
-
spec.summary = "Reserved"
|
12
|
-
spec.description = "Reserved"
|
13
|
-
spec.homepage = "https://phlex.fun"
|
14
|
-
spec.license = "MIT"
|
15
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
|
16
|
-
|
17
|
-
spec.metadata["homepage_uri"] = spec.homepage
|
18
|
-
spec.metadata["source_code_uri"] = "https://github.com/joeldrapper/phlex"
|
19
|
-
spec.metadata["changelog_uri"] = "https://github.com/joeldrapper/phlex"
|
20
|
-
|
21
|
-
# Specify which files should be added to the gem when it is released.
|
22
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
23
|
-
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
24
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
|
25
|
-
end
|
26
|
-
spec.bindir = "exe"
|
27
|
-
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
28
|
-
spec.require_paths = ["lib"]
|
29
|
-
|
30
|
-
# Uncomment to register a new dependency of your gem
|
31
|
-
# spec.add_dependency "example-gem", "~> 1.0"
|
32
|
-
|
33
|
-
# For more information and examples about making a new gem, checkout our
|
34
|
-
# guide at: https://bundler.io/guides/creating_gem.html
|
35
|
-
end
|
data/lib/blank/version.rb
DELETED