We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dear, Can I enable show line number for code?
The text was updated successfully, but these errors were encountered:
Not possible natively, but my extension has an option to capture the code block content from a function parameter, like this:
$parser->code_block_text = function($text) { return do_something($text); };
Example:
function add_line_numbers($text) { $a = []; foreach (explode("\n", $text) as $k => $v) { $a[] = '<span data-i="' . ($k + 1) . '">' . $v . '</span>'; } return implode("\n", $a); } $parser = new ParsedownExtraPlugin; $parser->code_block_text = function($text) { return add_line_numbers($text); }; echo '<style>pre [data-i]:before {content:attr(data-i) \' \'}</style>'; echo $parser->text('some content...');
Sorry, something went wrong.
No plans currently to add this into Parsedown core, so using an extension as mentioned above is the way to go :)
No branches or pull requests
Dear,
Can I enable show line number for code?
The text was updated successfully, but these errors were encountered: