aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorache <ache@ache.one>2020-05-05 09:36:55 +0200
committerache <ache@ache.one>2020-05-05 09:36:55 +0200
commit94e238b8c33fe15d91c51c524df5bb8424333512 (patch)
treeaf5046c6f2c660e3ed8cf830e6799b1c3db0a6fd /src
parentxo: style errors (diff)
Integrate atx inline feature
Diffstat (limited to 'src')
-rw-r--r--src/index.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/index.js b/src/index.js
index 0c3e47d..30d216d 100644
--- a/src/index.js
+++ b/src/index.js
@@ -299,6 +299,8 @@ function remarkAttr(userConfig) {
extend: {},
scope: 'extended',
mdAttrConfig: undefined,
+ enableAtxHeaderInline: true,
+ disableBlockElements: false,
};
const config = {...defaultConfig, ...userConfig};
@@ -312,7 +314,7 @@ function remarkAttr(userConfig) {
// For each elements, replace the old tokenizer by the new one
config.elements.forEach(elem => {
if (supportedElements.indexOf(elem) >= 0) {
- if (blockElements.indexOf(elem) >= 0) {
+ if (!config.disableBlockElements && blockElements.indexOf(elem) >= 0) {
const oldElem = tokenizersBlock[elem];
tokenizersBlock[elem] = tokenizeGenerator('\n', oldElem, config);
} else if (particularElements.indexOf(elem) >= 0) {
@@ -324,6 +326,11 @@ function remarkAttr(userConfig) {
elemTokenize.locator = tokenizers[elem].locator;
tokenizers[elem] = elemTokenize;
}
+
+ if (config.enableAtxHeaderInline && elem === 'atxHeading') {
+ const oldElem = tokenizersBlock[elem];
+ tokenizersBlock[elem] = tokenizeModifierGenerator(oldElem, config);
+ }
}
});
}