kramdown-mermaid 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +94 -10
- data/kramdown-mermaid.gemspec +3 -3
- data/lib/kramdown-mermaid/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5747e6858851060ab6e6e1af8b5cf6357a05c2902119f0eebb63e57ebf6bb1bd
|
4
|
+
data.tar.gz: 55a617e2987f41d40073c170ceaf2751657d447b875fc625c2d01bb4ddd98b2f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1bf3e87b1f9ca73a7b0a3637547334b20491c3d4bb8398b2e5b8863532d6749ad0a4bc292c8e41b39df3dae7cf93ea1ede874a345b856bb1e0c8f7079de14d7f
|
7
|
+
data.tar.gz: 31ce574c0b2df3410c279f212bdc27c1b0c72277efaf78a18c36e24ed308fe3a1c41ae033803051198d792caec176a460175a91cc390ae501f6bbb5296c98889
|
data/README.md
CHANGED
@@ -1,32 +1,116 @@
|
|
1
|
-
#
|
1
|
+
# kramdown-mermaid
|
2
2
|
|
3
|
-
This gem is
|
3
|
+
This is a gem for parsing [Mermaid syntax](https://mermaid.js.org/), and is an extension of [kramdown](https://kramdown.gettalong.org/).
|
4
|
+
|
5
|
+
Currently, only parsing of [Entity Relationship Diagrams](https://mermaid.js.org/syntax/entityRelationshipDiagram.html) is supported, but we hope to support parsing of Class Diagrams and Sequence Diagrams and more in the future.
|
4
6
|
|
5
7
|
## Installation
|
6
8
|
|
7
|
-
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
gem 'kramdown-mermaid'
|
8
12
|
|
9
|
-
|
13
|
+
And then execute:
|
10
14
|
|
11
|
-
$ bundle
|
15
|
+
$ bundle install
|
12
16
|
|
13
|
-
|
17
|
+
Or install it yourself as:
|
14
18
|
|
15
|
-
$ gem install
|
19
|
+
$ gem install kramdown-mermaid
|
16
20
|
|
17
21
|
## Usage
|
18
22
|
|
19
|
-
|
23
|
+
require 'kramdown'
|
24
|
+
require 'kramdown-mermaid'
|
25
|
+
|
26
|
+
text = <<EOS
|
27
|
+
|
28
|
+
# some title
|
29
|
+
ccc **ddd** eee
|
30
|
+
|
31
|
+
# Image
|
32
|
+
![Wikimedia](https://en.wikipedia.org/wiki/Wikimedia_Commons#/media/File:Commons-logo-en.svg "Wikimedia")
|
33
|
+
|
34
|
+
some comments
|
35
|
+
|
36
|
+
erDiagram %% some comment
|
37
|
+
hoges {
|
38
|
+
bigint id PK
|
39
|
+
int price
|
40
|
+
date start_on
|
41
|
+
datetime created_at
|
42
|
+
datetime updated_at
|
43
|
+
}
|
44
|
+
|
45
|
+
fugas {
|
46
|
+
bigint id PK
|
47
|
+
int price
|
48
|
+
datetime created_at
|
49
|
+
datetime updated_at
|
50
|
+
}
|
51
|
+
|
52
|
+
hoges |o--o{ fugas: "some comment"**
|
53
|
+
EOS
|
54
|
+
|
55
|
+
Kramdown::Document.new(text, input: 'KramdownMermaid').to_hash_ast
|
56
|
+
|
57
|
+
# =>
|
58
|
+
{:type=>:root,
|
59
|
+
:options=>{:encoding=>#<Encoding:UTF-8>, :location=>1, :options=>{}, :abbrev_defs=>{}, :abbrev_attr=>{}, :footnote_count=>0},
|
60
|
+
:children=>
|
61
|
+
[{:type=>:header,
|
62
|
+
:options=>{:level=>1, :raw_text=>"some title", :location=>1},
|
63
|
+
:children=>[{:type=>:text, :value=>"some title", :options=>{:location=>1}}]},
|
64
|
+
{:type=>:p,
|
65
|
+
:options=>{:location=>2},
|
66
|
+
:children=>
|
67
|
+
[{:type=>:text, :value=>"ccc ", :options=>{:location=>2}},
|
68
|
+
{:type=>:strong, :options=>{:location=>2}, :children=>[{:type=>:text, :value=>"ddd", :options=>{:location=>2}}]},
|
69
|
+
{:type=>:text, :value=>" eee", :options=>{:location=>2}}]},
|
70
|
+
{:type=>:blank, :value=>"\n"},
|
71
|
+
{:type=>:header, :options=>{:level=>1, :raw_text=>"Image", :location=>4}, :children=>[{:type=>:text, :value=>"Image", :options=>{:location=>4}}]},
|
72
|
+
{:type=>:p,
|
73
|
+
:options=>{:location=>5},
|
74
|
+
:children=>
|
75
|
+
[{:type=>:img,
|
76
|
+
:attr=>{"src"=>"https://en.wikipedia.org/wiki/Wikimedia_Commons#/media/File:Commons-logo-en.svg", "alt"=>"Wikimedia", "title"=>"Wikimedia"},
|
77
|
+
:options=>{:location=>5, :ial=>nil}}]},
|
78
|
+
{:type=>:blank, :value=>"\n"},
|
79
|
+
{:type=>:p, :options=>{:location=>7}, :children=>[{:type=>:text, :value=>"some comments", :options=>{:location=>7}}]},
|
80
|
+
{:type=>:blank, :value=>"\n"},
|
81
|
+
{:type=>:er_diagram, :value=>"erDiagram %% some comment \n", :options=>{:location=>10}},
|
82
|
+
{:type=>:p,
|
83
|
+
:options=>{:location=>10},
|
84
|
+
:children=>
|
85
|
+
[{:type=>:text,
|
86
|
+
:value=>"hoges { \n bigint id PK\n int price\n date start_on\n datetime created_at\n datetime updated_at\n }",
|
87
|
+
:options=>{:location=>10}}]},
|
88
|
+
{:type=>:entity,
|
89
|
+
:value=>" \n fugas {\n bigint id PK\n int price\n datetime created_at\n datetime updated_at\n }",
|
90
|
+
:options=>
|
91
|
+
{:entity=>"fugas",
|
92
|
+
:attributes=>
|
93
|
+
[{:type=>"bigint", :name=>"id", :constraint=>"PK"},
|
94
|
+
{:type=>"int", :name=>"price", :constraint=>nil},
|
95
|
+
{:type=>"datetime", :name=>"created_at", :constraint=>nil},
|
96
|
+
{:type=>"datetime", :name=>"updated_at", :constraint=>nil}],
|
97
|
+
:location=>24}},
|
98
|
+
{:type=>:relation,
|
99
|
+
:value=>"\n\nhoges |o--o{ fugas: \"some comment\"\n",
|
100
|
+
:options=>{:left_entity=>"hoges", :left_relation=>"|o", :right_relation=>"o{", :right_entity=>"fugas", :location=>26}}]}
|
101
|
+
|
20
102
|
|
21
103
|
## Development
|
22
104
|
|
23
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec`
|
105
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` or `bundle exec rspec` on root to run the tests.
|
106
|
+
You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
24
107
|
|
25
108
|
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).
|
26
109
|
|
27
110
|
## Contributing
|
28
111
|
|
29
|
-
|
112
|
+
PRs and issues are always welcomed on GitHub at https://github.com/38tter/kramdown-mermaid.
|
113
|
+
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]/kramdown-mermaid/blob/master/CODE_OF_CONDUCT.md).
|
30
114
|
|
31
115
|
## License
|
32
116
|
|
data/kramdown-mermaid.gemspec
CHANGED
@@ -10,15 +10,15 @@ Gem::Specification.new do |spec|
|
|
10
10
|
|
11
11
|
spec.summary = 'Extended Kramdown syntax for mermaid.js'
|
12
12
|
spec.description = 'Extended Kramdown syntax for mermaid.js'
|
13
|
-
spec.homepage = 'https://github.com/38tter/kramdown-mermaid
|
13
|
+
spec.homepage = 'https://github.com/38tter/kramdown-mermaid'
|
14
14
|
spec.license = 'MIT'
|
15
15
|
spec.required_ruby_version = '>= 2.6.0'
|
16
16
|
|
17
17
|
# spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'"
|
18
18
|
|
19
19
|
spec.metadata['homepage_uri'] = spec.homepage
|
20
|
-
spec.metadata['source_code_uri'] = 'https://github.com/38tter/kramdown-mermaid
|
21
|
-
spec.metadata['changelog_uri'] = 'https://github.com/38tter/kramdown-mermaid
|
20
|
+
spec.metadata['source_code_uri'] = 'https://github.com/38tter/kramdown-mermaid'
|
21
|
+
spec.metadata['changelog_uri'] = 'https://github.com/38tter/kramdown-mermaid/blob/main/CHANGELOG.md'
|
22
22
|
|
23
23
|
# Specify which files should be added to the gem when it is released.
|
24
24
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kramdown-mermaid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Seiya Miyata
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-06-
|
11
|
+
date: 2023-06-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: kramdown
|
@@ -43,13 +43,13 @@ files:
|
|
43
43
|
- lib/kramdown-mermaid/parser/kramdown.rb
|
44
44
|
- lib/kramdown-mermaid/version.rb
|
45
45
|
- sig/kramdown-mermaid.rbs
|
46
|
-
homepage: https://github.com/38tter/kramdown-mermaid
|
46
|
+
homepage: https://github.com/38tter/kramdown-mermaid
|
47
47
|
licenses:
|
48
48
|
- MIT
|
49
49
|
metadata:
|
50
|
-
homepage_uri: https://github.com/38tter/kramdown-mermaid
|
51
|
-
source_code_uri: https://github.com/38tter/kramdown-mermaid
|
52
|
-
changelog_uri: https://github.com/38tter/kramdown-mermaid
|
50
|
+
homepage_uri: https://github.com/38tter/kramdown-mermaid
|
51
|
+
source_code_uri: https://github.com/38tter/kramdown-mermaid
|
52
|
+
changelog_uri: https://github.com/38tter/kramdown-mermaid/blob/main/CHANGELOG.md
|
53
53
|
post_install_message:
|
54
54
|
rdoc_options: []
|
55
55
|
require_paths:
|