4

I was trying to markdown some points and tried to highlight some important parts within documentation based on this tutorial unsuccessfully.

I could manage to run the following correctly neither in the Databricks notebook nor GoogleColab notebook:

%md

This is <span style="background-color: #FFFF00">highlighted</span>
This is <span style="color:red">red</span>

desired markdown results:

img

4
  • I am also seeing same issue with databricks notebooks Commented Dec 19, 2022 at 23:59
  • So far credit to this answer, I could manage to change the color by </font> instead of </span> e.g., This is <font color='red'> red </font>. but still I can't change the text background color. I checked some workaround1, workaround1. workaround3. Commented Dec 20, 2022 at 1:28
  • 1
    This is <font color='red'> red </font> does not work for me. I do not think this is supported in Databricks, but I cannot find any official documentation stating it. Commented Dec 21, 2022 at 1:40
  • @DavidGibson it works in GoogleColab notebook but not in Databricks notebook Commented Dec 21, 2022 at 1:42

2 Answers 2

0

I have reproduced in my environment and got expected results as below in google Collab:

This is <font  color='red'> red </font>

<mark  style="background-color: lightblue">Rithwik</mark>

enter image description here

AFAIK, I couldn't find any Official Documentation on Markdown (Highlighting words) and this feature is not supported in Databricks by my understanding and i would suggest you raise a feature request.

Sign up to request clarification or add additional context in comments.

Comments

0

Not sure if this is relevant now but in databricks you cannot add colors when the language is MD. However if the cell is scala/python, html is displaying properly. screenshot from databricks

displayHTML("""
<p><h2>Load Files:</h2></p>
<p>This method provides a generic functionality to load files into a dataframe. This takes some mandatory parameters like format of the file, path of the file and some optional parameters dependent upon each file type and returns a dataframe. </p>
<p style='color:red'><b>Note:</b></p>
<p>This method may not cover all the edge cases and cant be used for each and every file type. This is just a wrapper function to cover basic file formats like CSV, Json and Parquet files. </p>
<p style='color:green'>This is how you can use can use this method
<pre><code>
val csvOptions = Map("header" -> "true", "delimiter" -> ",")
val csvSource = DataSource("/path/to/file.csv", "csv", csvOptions)
val df = loadDataSource(spark, csvSource)
</code></pre> </p>
""")

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.