This repository has been archived by the owner on Nov 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(markdown): add missing compilers (#808)
* fix(markdown): add missing compilers
- [x] add `tableHead` markdown compiler (fixes #772)
- [x] add `figure` markdown compiler
* refactor(markdown): restructure compiler imports
* fix(markdown): compile figcaptions
* fix(markdown): rename pin compile method
...so the pin compiler doesdn't override the default `visitors.div` method
* refactor(markdown): figcaption compiler
split `figcaption` compiler out of the `figure` visitor methods
* chore(markdown): add test.watch script alias
'cause I'm fuckin' lazy...
* refactor(markdown): restructure custom parsers and compilers
* test(markdown): figure compiler
- v13.4.18
- v13.4.17
- v13.4.16
- v13.4.15
- v13.4.14
- v13.4.13
- v13.4.12
- v13.4.11
- v13.4.10
- v13.4.9
- v13.4.8
- v13.4.7
- v13.4.6
- v13.4.5
- v13.4.4
- v13.4.3
- v13.4.2
- v13.4.1
- v13.4.0
- v13.3.0
- v13.2.4
- v13.2.3
- v13.2.2
- v13.2.1
- v13.2.0
- v13.1.0
- v13.0.0
- v12.2.6
- v12.2.5
- v12.2.4
- v12.2.3
- v12.2.2
- v12.2.1
- v12.2.0
- v12.1.0
- v12.0.0
- v11.2.2
- v11.2.1
- v11.2.0
- v11.1.6
- v11.1.5
- v11.1.4
- v11.1.3
- v11.1.2
- v11.1.1
- v11.1.0
- v11.0.2
- v11.0.1
- v11.0.0
- v10.1.1
- v10.1.0
- v10.0.9
- v10.0.8
- v10.0.7
- v10.0.6
- v10.0.5
- v10.0.4
- v10.0.3
- v10.0.2
- v10.0.1
- v10.0.0
- v10.0.0-alpha.0
- v9.3.0
- v9.2.3
- v9.2.2
- v9.2.1
- v9.2.0
- v9.1.0
- v9.0.2
- v9.0.1
- v9.0.0
- v8.1.1
- v8.1.0
- v8.0.3
- v8.0.2
- v8.0.1
- v8.0.0
- v7.6.1
- v7.6.0
- v7.5.0
- v7.4.0
- v7.3.0
- v7.2.3
- v7.2.2
- v7.2.1
- v7.2.0
- v7.1.1
- v7.1.0
- v7.0.1
- v7.0.0
- v6.16.1
- v6.16.0
- v6.15.2
- v6.15.1
- v6.15.0
- v6.14.1
- v6.14.0
- v6.13.1
- v6.13.0
1 parent
6afc047
commit 3a6e720
Showing
9 changed files
with
92 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
const nodeToString = require('hast-util-to-string'); | ||
|
||
module.exports = function FigureCompiler() { | ||
const { Compiler } = this; | ||
const { visitors } = Compiler.prototype; | ||
|
||
visitors.figcaption = function figcaptionCompiler(node) { | ||
const caption = nodeToString(node); | ||
return `<figcaption>${caption}</figcaption>`; | ||
}; | ||
|
||
visitors.figure = function figureCompiler(node) { | ||
const [image, caption] = node.children; | ||
return `<figure> | ||
${visitors.image.call(this, image)} | ||
${visitors.figcaption.call(this, caption)} | ||
</figure>`; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
/* div blocks directly alias the paragraph container; use for display only! */ | ||
module.exports = function DivCompiler() { | ||
module.exports = function PinCompiler() { | ||
const { Compiler } = this; | ||
const { visitors } = Compiler.prototype; | ||
visitors.div = function compile(/* node */) { | ||
return 'PINNNED'; | ||
}; | ||
function compiler(node) { | ||
return [`<div class="rdmd-pinned">`, this.block(node), `</div>`].join('\n\n'); | ||
} | ||
visitors['rdme-pin'] = compiler; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = function TableHeadCompiler() { | ||
const { Compiler } = this; | ||
const { visitors } = Compiler.prototype; | ||
visitors.tableHead = function compile(node) { | ||
return visitors.tableCell.call(this, node); | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
export { default as magicBlockParser } from './magic-block-parser'; | ||
|
||
export { default as flavorCodeTabs } from './flavored/code-tabs'; | ||
export { default as flavorCallout } from './flavored/callout'; | ||
export { default as flavorEmbed } from './flavored/embed'; | ||
export { default as magicBlockParser } from './magic-block-parser'; | ||
|
||
export { default as compactHeadings } from './compact-headings'; | ||
export { default as variableParser } from './variable-parser'; | ||
export { default as gemojiParser } from './gemoji-parser'; | ||
export { default as compactHeadings } from './compact-headings'; |