phlex-markdown 0.0.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.editorconfig +13 -0
- data/.rubocop.yml +15 -0
- data/Gemfile +7 -4
- data/README.md +7 -36
- data/SECURITY.md +5 -0
- data/lib/phlex/markdown.rb +91 -0
- metadata +44 -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: 70814edaf961f6b8b86c4918d06a92cb9d9d890dd7614dea761a03982b0ff8ce
|
4
|
+
data.tar.gz: 5fc9e240f463805e88d718f5b1fe5ce2a9d099367cac196288b68657bd895505
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf89b40b70e6d5fe0ed463e7756b6ba9f236eb95c1a23a6786e43df0f992bcf2d10f03c1dda23ec63f10058256e0c5704c35269a2bdd941a0f110fb3110cbdc5
|
7
|
+
data.tar.gz: 56f39bdc50391a200f938a841637618d406eee64ea2d3e217dbc12b6636a4b0fe06d2bd58285de1cdf1980b35737be4528b5fc19113e18157c209136dfc21997
|
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,13 @@
|
|
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 "phlex", github: "joeldrapper/phlex"
|
9
|
+
gem "capybara"
|
10
|
+
gem "rubocop"
|
11
|
+
gem "solargraph"
|
12
|
+
gem "sus"
|
13
|
+
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,91 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "phlex"
|
4
|
+
require "markly"
|
5
|
+
|
6
|
+
module Phlex
|
7
|
+
class Markdown < Phlex::HTML
|
8
|
+
def initialize(content)
|
9
|
+
@content = content
|
10
|
+
end
|
11
|
+
|
12
|
+
def template
|
13
|
+
visit(doc)
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def doc
|
19
|
+
Markly.parse(@content)
|
20
|
+
end
|
21
|
+
|
22
|
+
def visit(node)
|
23
|
+
return if node.nil?
|
24
|
+
|
25
|
+
case node.type
|
26
|
+
in :document | :softbreak
|
27
|
+
visit_children(node)
|
28
|
+
in :text
|
29
|
+
text(node.string_content)
|
30
|
+
in :header
|
31
|
+
case node.header_level
|
32
|
+
in 1 then h1 { visit_children(node) }
|
33
|
+
in 2 then h2 { visit_children(node) }
|
34
|
+
in 3 then h3 { visit_children(node) }
|
35
|
+
in 4 then h4 { visit_children(node) }
|
36
|
+
in 5 then h5 { visit_children(node) }
|
37
|
+
in 6 then h6 { visit_children(node) }
|
38
|
+
end
|
39
|
+
in :paragraph
|
40
|
+
grandparent = node.parent&.parent
|
41
|
+
|
42
|
+
if grandparent&.type == :list && grandparent&.list_tight
|
43
|
+
visit_children(node)
|
44
|
+
else
|
45
|
+
p { visit_children(node) }
|
46
|
+
end
|
47
|
+
in :link
|
48
|
+
a(href: node.url, title: node.title) { visit_children(node) }
|
49
|
+
in :image
|
50
|
+
img(
|
51
|
+
src: node.url,
|
52
|
+
alt: node.each.first.string_content,
|
53
|
+
title: node.title
|
54
|
+
)
|
55
|
+
in :emph
|
56
|
+
em { visit_children(node) }
|
57
|
+
in :strong
|
58
|
+
strong { visit_children(node) }
|
59
|
+
in :list
|
60
|
+
case node.list_type
|
61
|
+
in :ordered_list then ol { visit_children(node) }
|
62
|
+
in :bullet_list then ul { visit_children(node) }
|
63
|
+
end
|
64
|
+
in :list_item
|
65
|
+
li { visit_children(node) }
|
66
|
+
in :code
|
67
|
+
code { text(node.string_content) }
|
68
|
+
in :code_block
|
69
|
+
code_block(node.string_content, language: node.fence_info) do |**attributes|
|
70
|
+
pre(**attributes) do
|
71
|
+
code(class: "language-#{node.fence_info}") do
|
72
|
+
text(node.string_content)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
in :hrule
|
77
|
+
hr
|
78
|
+
in :blockquote
|
79
|
+
blockquote { visit_children(node) }
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
def code_block(code, language:)
|
84
|
+
yield
|
85
|
+
end
|
86
|
+
|
87
|
+
def visit_children(node)
|
88
|
+
node.each { |c| visit(c) }
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
metadata
CHANGED
@@ -1,41 +1,67 @@
|
|
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.2.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
|
-
- blank.gemspec
|
30
|
-
- lib/blank.rb
|
31
|
-
- lib/blank/version.rb
|
32
|
-
homepage: https://phlex.fun
|
54
|
+
- SECURITY.md
|
55
|
+
- lib/phlex/markdown.rb
|
56
|
+
homepage: https://github.com/joeldrapper/phlex-markdown
|
33
57
|
licenses:
|
34
58
|
- MIT
|
35
59
|
metadata:
|
36
|
-
homepage_uri: https://phlex
|
37
|
-
source_code_uri: https://github.com/joeldrapper/phlex
|
38
|
-
changelog_uri: https://github.com/joeldrapper/phlex
|
60
|
+
homepage_uri: https://github.com/joeldrapper/phlex-markdown
|
61
|
+
source_code_uri: https://github.com/joeldrapper/phlex-markdown
|
62
|
+
changelog_uri: https://github.com/joeldrapper/phlex-markdown/releases
|
63
|
+
funding_uri: https://github.com/sponsors/joeldrapper
|
64
|
+
rubygems_mfa_required: 'true'
|
39
65
|
post_install_message:
|
40
66
|
rdoc_options: []
|
41
67
|
require_paths:
|
@@ -44,7 +70,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
44
70
|
requirements:
|
45
71
|
- - ">="
|
46
72
|
- !ruby/object:Gem::Version
|
47
|
-
version: 2.
|
73
|
+
version: '2.7'
|
48
74
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
49
75
|
requirements:
|
50
76
|
- - ">="
|
@@ -54,5 +80,5 @@ requirements: []
|
|
54
80
|
rubygems_version: 3.3.25
|
55
81
|
signing_key:
|
56
82
|
specification_version: 4
|
57
|
-
summary:
|
83
|
+
summary: A Markdown view for Phlex
|
58
84
|
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