MCPcopy Create free account
hub / github.com/TruthHun/BookStack / getType

Function getType

static/editor.md/lib/codemirror/mode/markdown/markdown.js:226–306  ·  view source on GitHub ↗
(state)

Source from the content-addressed store, hash-verified

224
225 // Inline
226 function getType(state) {
227 var styles = [];
228
229 if (state.formatting) {
230 styles.push(formatting);
231
232 if (typeof state.formatting === "string") state.formatting = [state.formatting];
233
234 for (var i = 0; i < state.formatting.length; i++) {
235 styles.push(formatting + "-" + state.formatting[i]);
236
237 if (state.formatting[i] === "header") {
238 styles.push(formatting + "-" + state.formatting[i] + "-" + state.header);
239 }
240
241 // Add `formatting-quote` and `formatting-quote-#` for blockquotes
242 // Add `error` instead if the maximum blockquote nesting depth is passed
243 if (state.formatting[i] === "quote") {
244 if (!modeCfg.maxBlockquoteDepth || modeCfg.maxBlockquoteDepth >= state.quote) {
245 styles.push(formatting + "-" + state.formatting[i] + "-" + state.quote);
246 } else {
247 styles.push("error");
248 }
249 }
250 }
251 }
252
253 if (state.taskOpen) {
254 styles.push("meta");
255 return styles.length ? styles.join(' ') : null;
256 }
257 if (state.taskClosed) {
258 styles.push("property");
259 return styles.length ? styles.join(' ') : null;
260 }
261
262 if (state.linkHref) {
263 styles.push(linkhref);
264 return styles.length ? styles.join(' ') : null;
265 }
266
267 if (state.strong) { styles.push(strong); }
268 if (state.em) { styles.push(em); }
269 if (state.strikethrough) { styles.push(strikethrough); }
270
271 if (state.linkText) { styles.push(linktext); }
272
273 if (state.code) { styles.push(code); }
274
275 if (state.header) { styles.push(header); styles.push(header + "-" + state.header); }
276
277 if (state.quote) {
278 styles.push(quote);
279
280 // Add `quote-#` where the maximum for `#` is modeCfg.maxBlockquoteDepth
281 if (!modeCfg.maxBlockquoteDepth || modeCfg.maxBlockquoteDepth >= state.quote) {
282 styles.push(quote + "-" + state.quote);
283 } else {

Callers 9

blockNormalFunction · 0.70
leavingLocalFunction · 0.70
handleTextFunction · 0.70
inlineNormalFunction · 0.70
linkInlineFunction · 0.70
linkHrefFunction · 0.70
getLinkHrefInsideFunction · 0.70
footnoteLinkFunction · 0.70
footnoteLinkInsideFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected