Skip to content
New issue

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

[MarkdownSection] Adds code highlighting #1737

Merged
merged 9 commits into from
Mar 25, 2024
Merged

Conversation

oneolddev
Copy link
Contributor

Pull Request

📖 Description

Adds code highlighting for code blocks in markdown file consistent with CodeSnippet component.

  • A Markdig extension was added to replace the default one provided by Markdig to add classes to the generated HTML pre tags.
  • Javascript was added to call the hljs.highlightElement for each code block.
  • Copy button was added.

🎫 Issues

An example of use with the DesignTokens page

Current appearance

image

New appearance

image

👩‍💻 Reviewer Notes

This is the first Markdig extension I have written. I opted to clone the original CodeBlockRenderer and only modify.

📑 Test Plan

Tested with demo site - Client and Server

✅ Checklist

General

  • I have added tests for my changes.
  • I have tested my changes.
  • I have updated the project documentation to reflect my changes.
  • I have read the CONTRIBUTING documentation and followed the standards for this project.

Component-specific

  • I have added a new component
  • I have added Unit Tests for my new compontent
  • I have modified an existing component
  • I have validate Unit Tests for an existing component

⏭ Next Steps

Sorry, something went wrong.

@dvoituron dvoituron requested review from vnbaaij and dvoituron March 25, 2024 19:51
@vnbaaij vnbaaij enabled auto-merge (squash) March 25, 2024 20:27
@vnbaaij vnbaaij disabled auto-merge March 25, 2024 20:27
@vnbaaij vnbaaij merged commit a72cde8 into microsoft:dev Mar 25, 2024
3 of 4 checks passed
@oneolddev oneolddev deleted the markdownfix branch April 17, 2024 07:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants