mark.js没有在括号内突出显示一个单词?

问题描述

在给定用户查询的情况下,我正在尝试marker.js突出显示括号内的包含单词。

例如,当用户进行查询

“ covid-19是如何产生的?”

以及答案中的答案:

2019年冠状病毒病(COVID‑19)是一种传染病,由 重症急性呼吸综合征冠状病毒2(SARS-CoV-2)。

我希望括号内的文本“ COVID-19”突出显示。当前参数突出显示了没有括号的COVID-19出现的情况,但是当它们在括号内时,它将无法正常工作。

这是我当前的工作片段:

var brands = "where the covid-19 originated?";

var instance = new Mark(document.querySelector("body"));

instance.mark(brands,{
    accuracy: {
      value: "exactly",limiters: [".",","(",")"]
    },ignorePunctuation: ":;.,-–—‒_(){}[]!'\"+=?!".split(""),wildcards: "enabled",separatewordsearch: true,acrossElements: true
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/mark.js/7.0.0/mark.min.js"></script>
<body>
  <div>Coronavirus disease 2019 (COVID‑19) is an infectIoUs disease caused by severe acute respiratory syndrome coronavirus 2 (SARS-CoV-2).

It was first identified in December 2019 in Wuhan,Hubei,China,and has resulted in an ongoing pandemic.

As of 23 August 2020,more than 23.1 million cases have been reported across 188 countries and territories,resulting in more than 802,000 deaths.

More than 14.8 million people have recovered.Common symptoms include fever,cough,fatigue,shortness of breath,and loss of smell and taste.

While most people have mild symptoms,some people develop acute respiratory distress syndrome (ARDS) possibly precipitated by cytokine storm,multi-organ failure,septic shock,and blood clots.

The time from exposure to onset of symptoms is typically around five days,but may range from two to fourteen days.The virus is spread primarily via nose and mouth secretions including small droplets produced by coughing,sneezing,and talking.

The droplets usually do not travel through air over long distances.

However,those standing in close proximity may inhale these droplets and become infected.

People may also become infected by touching a contaminated surface and then touching their face.

The transmission may also occur through smaller droplets that are able to stay suspended in the air for longer periods of time in enclosed spaces.

It is most contagIoUs during the first three days after the onset of symptoms,although spread is possible before symptoms appear,and from people who do not show symptoms.

The standard method of diagnosis is by real-time reverse transcription polymerase chain reaction (rRT-PCR) from a nasopharyngeal swab.

Chest CT imaging may also be helpful for diagnosis in individuals where there is a high suspicion of infection based on symptoms and risk factors; however,guidelines do not recommend using CT imaging for routine screening.Recommended measures to prevent infection include frequent hand washing,maintaining physical distance from others (especially from those with symptoms),quarantine (especially for those with symptoms),covering coughs,and keeping unwashed hands away from the face.

The use of cloth face coverings such as a scarf or a bandana has been recommended by health officials in public settings to minimise the risk of transmissions,with some authorities requiring their use.

Health officials also stated that medical-grade face masks,such as N95 masks,should be used only by healthcare workers,first responders,and those who directly care for infected individuals.There are no proven vaccines nor specific antiviral treatments for COVID-19.

Management involves the treatment of symptoms,supportive care,isolation,and experimental measures.

The World Health Organization (WHO) declared the COVID‑19 outbreak a public health emergency of international concern (PHEIC) on 30 January 2020 and a pandemic on 11 march 2020.

Local transmission of the disease has occurred in most countries across all six WHO regions.</div>
</body>

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...