You appear to be a bot. Output may be restricted
Description
Check that it really is a list itemTrue markdown requires lists to be separated by blank lines. But we were happy to create a list without the blank line. This caused a problem in some situations. — like this one ** or this one? But we also have to cater for bold markdown with two stars and bold markdown with underscores while making sure
- we cater for normal lists
- with stars or underscores
$line starts | $last_line_len | It’s a list? |
---|---|---|
– | n/a | true |
* | n/a | true |
`–` | 0 | true |
`–` | >0 | $list |
`**` | 0 | true |
`**` | >0 | $list |
Usage
$bool = oikai_check_its_a_list( $list, $line, $last_line_len );
Parameters
- $list
- ( integer ) required – current list nesting level
- $line
- ( string ) required –
- $last_line_len
- ( integer ) required –
Returns
bool true if we think it's a listSource
File name: oik-shortcodes/shortcodes/oik-api-importer.phpLines:
1 to 12 of 12
function oikai_check_its_a_list( $list, $line, $last_line_len ) { $its_a_list = false; $line_starts = substr( $line, 0, 2 ); if ( $line_starts == '- ' || $line_starts == '* ') { $its_a_list = true; } elseif ( $line_starts == "--" || $line_starts == '**' ) { if ( $last_line_len > 0 ) { $its_a_list=$list; } } return( $its_a_list ); }View on GitHub