3 module.exports = atxHeading;
10 var MAX_ATX_COUNT = 6;
12 function atxHeading(eat, value, silent) {
14 var settings = self.options;
15 var length = value.length + 1;
24 /* Eat initial spacing. */
25 while (++index < length) {
26 character = value.charAt(index);
28 if (character !== C_SPACE && character !== C_TAB) {
33 subvalue += character;
39 while (++index <= length) {
40 character = value.charAt(index);
42 if (character !== C_HASH) {
47 subvalue += character;
51 if (depth > MAX_ATX_COUNT) {
57 (!settings.pedantic && value.charAt(index + 1) === C_HASH)
62 length = value.length + 1;
64 /* Eat intermediate white-space. */
67 while (++index < length) {
68 character = value.charAt(index);
70 if (character !== C_SPACE && character !== C_TAB) {
78 /* Exit when not in pedantic mode without spacing. */
83 character !== C_NEWLINE
97 while (++index < length) {
98 character = value.charAt(index);
100 if (!character || character === C_NEWLINE) {
105 character !== C_SPACE &&
106 character !== C_TAB &&
109 content += queue + character;
114 while (character === C_SPACE || character === C_TAB) {
116 character = value.charAt(++index);
119 while (character === C_HASH) {
121 character = value.charAt(++index);
124 while (character === C_SPACE || character === C_TAB) {
126 character = value.charAt(++index);
132 now.column += subvalue.length;
133 now.offset += subvalue.length;
134 subvalue += content + queue;
136 return eat(subvalue)({
139 children: self.tokenizeInline(content, now)